Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: RESOLVED: How to count values of 1 of 2 records Post Reply Post New Topic
Author Message
dlg_az
Newbie
Newbie


Joined: 16 May 2011
Location: United States
Online Status: Offline
Posts: 14
Quote dlg_az Replybullet Topic: RESOLVED: How to count values of 1 of 2 records
     Posted: 15 Jul 2011 at 10:45am
Sorry, I changed the title twice, trying to give a good description of what I need.
 
I have a report where I am listing training classes taken, number of attendees, month taken, and the instructor(s).
 
My problem:
- there can be two instructors for the same class during the same time. 
- instructor names can vary, they are never static.
- all other record fields are exactly the same
- only differentiating field is the instructor field. 
 
While there are two database records for such a class, the report is grouped by the class name and so shows only one class record with one instructor name, but counts the attendees twice due to the second instructor record.
 
Any help on how I can adjust the report to count the attendees only once would be greatly appreciated.
 
Update:  I resolved the issue by creating a Summary field with a "distinct count" for the Attendee number per grouped class. 
 
New Issue:  How do I get the Attendee GRAND total to show the total of  the distinct count Summary field? It's an invalid field of choice for a Running Total and for a Summary total.   If I use a summary field on the attendee number with a "distinct count", it reduces the grand total by more than the distinct-count amounts I managed to suppress.  If I use a regular "count" it adds back in the exact total of the suppressed amounts.


Edited by dlg_az - 19 Jul 2011 at 5:18pm
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 15 Jul 2011 at 2:33pm
If you take your Number of Attendees field and format by checking the "Supress If Duplicated" button it should fix the doubling for you and if it does work should allow you to get your totals by using the field instead of the summary.
IP IP Logged
dlg_az
Newbie
Newbie


Joined: 16 May 2011
Location: United States
Online Status: Offline
Posts: 14
Quote dlg_az Replybullet Posted: 15 Jul 2011 at 3:51pm
Originally posted by CircleD

If you take your Number of Attendees field and format by checking the "Supress If Duplicated" button it should fix the doubling for you and if it does work should allow you to get your totals by using the field instead of the summary.
 
Thank you for the response.  Unfortunately, that doesn't work.  The only way I have found to get it to not double is by using a distinct count on the Attendees field. 
IP IP Logged
dlg_az
Newbie
Newbie


Joined: 16 May 2011
Location: United States
Online Status: Offline
Posts: 14
Quote dlg_az Replybullet Posted: 19 Jul 2011 at 5:16pm
Update 2: I solved the second issue by using WhenPrintingRecords formulas in the header, footer and detail sections; one to reset the counter to zero, one to keep a running total, and a last to show the full total.

Then I found that CR actually counts the last row a second time. I had to research that a bit, but found that to get around that I had to add a fourth formula to deduct the counter and the count of the Attendees, then added that to the group footer. Finally got all the correct numbers I was looking for.

I'm pretty new to CR and it took me days to figure this out, but I did, and I have to say I'm surprised that more of the more-experienced folks in this forum didn't take up the request for assistance.  Nonetheless, I hope my journey of learning and my updates helps someone else here. 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum