Can anyone help with counting distinct records within 2 groups? Here's the problem I'm trying to resolve:
- I have one group, grouped by {BoardPayments.ContractID}
- I have a second group within {BoardPayments.ContractID} grouped by {BoardPayments.RateID}
- I want to get a total count of Distinct {BoardPayments.ClientID} within each {BoardPayments.RateID} group and then get a total count of those distinct {BoardPayments.ClientID} for the {BoardPayments.ContractID} group.
If I try and get a distinct count of {BoardPayments.ClientID} in the Footer of the {BoardPayments.ContractID} group, the count may be wrong because there may be a {BoardPayments.ClientID} in 2 different {BoardPayments.RateID} group so I'd want to count both of them.
I've tried to use Running Totals and Formulas but I keep getting errors like "This field cannot be summarized". Here's what I've done so far:
Formula 1
WhilePrintingRecords;
Shared NumberVar sumClientID := 0;
Formula 2
WhilePrintingRecords;
NumberVar sumClientID;
sumClientID := DistinctCount ({BoardPayments.ClientID}, {BoardPayments.RateID})
Formula 3
***This is where I need the help. I've tried doing a Count of Formula 2 but that doesn't work. Any ideas?********