Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum of Distict Counts

Status
Not open for further replies.

Crystalfire

Programmer
Jan 29, 2002
315
US
I need to get the sums of multiple groups' Distinct Counts. Any ideas?
 
Here's one:


WhilePrintingRecords;
NumberVar DCSum;

DCSum := DCSum + DistinctCount ({Whatever});

Place this in the section where DistinctCount is evaluated.

If this ever needs to be reset, set it back to 0 with:

WhilePrintingRecords;
NumberVar DCSum := 0;

Naith
 
DCSum is just the name of the variable which is summing up your distinct count.

If your distinct count field is called 'Distinct Count of X', grouped by Y then replace the variable assignment line to read:

DCSum := DCSum + DistinctCount ({X},{Y});

Naith
 
It sounds like Running Totals or standard summaries may work for you, instead of a distinct count at the group level, select a grand total.

i.e.:

Place the field to do a distinct count on in the detail section, right click it, select insert->Summary

Now select Distinct Count for the calculation type, and check the Insert Grand Total.

You now have distinct counts at the group and report levels.

-k kai@informeddatadecisions.com
 
That worked great. Is there also a way to get the sums of running total by group? Thanks for your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top