Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Calculate records before sorting Post Reply Post New Topic
Author Message
J2112
Newbie
Newbie


Joined: 09 Apr 2009
Online Status: Offline
Posts: 7
Quote J2112 Replybullet Topic: Calculate records before sorting
     Posted: 25 Jun 2009 at 5:42pm
I hope this is an easy one that I'm just overlooking.  I'm bringing in records that include a field that contains "yes" and "no".  I only want the report to show the "no" records, and I can calculate the total records easy enough.  I need to show the "no" calculation as a percentage of all "yes" and "no" records, but I'm not sure how to calculate all records?  Select expert is selecting all of the "no" values, and the only other variable is a date-range Parameter field (to run the report based on a user-selected date range).  So I will need the "yes/no" total for only the date range selected.

Thanks.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jun 2009 at 8:33pm
Lots of ways to do this just depends on how you need to display and what else is going oon in the report (and your preferences).
1. You can use a Running Total to conditionally count the "NO" fields, do a count of all records and then use a formula to show % as
#RT % COUNT(table.field)
2. create a formula to flag make a "NO" 1 and a "Yes" 0 then SUM that formula and do a COUNT of all and divide same as option1.
if table.field = "No" then 1 else 0
3. Use variables to get your counts -  same premise as option 1 but use formulas to set your variable up to only count "NO" fields.
4. Group on the YES/NO field, do a COUNT of the records at grouplevel1 and set that as a percentage of the total.
 
almost forget, do not do anything with the YES/NO field in your select expert.
You can use the date parameters with no issues but if you use the YES/NO field it will exclude the records preventing any precentage from being able to be determined.


Edited by DBlank - 25 Jun 2009 at 8:37pm
IP IP Logged
J2112
Newbie
Newbie


Joined: 09 Apr 2009
Online Status: Offline
Posts: 7
Quote J2112 Replybullet Posted: 26 Jun 2009 at 2:20pm
DBlank thanks for the suggestions.  I was hoping it was going to be relatively simple.  I ended up creating the Running Total field to count all "No" records, used a suppression formula on the detail section to remove the "yes" records, added a summary field to count all records, and then created the formula field to come up with the percentage of "No" records vs. all records.  It works, that's all that matters.

Edited by J2112 - 26 Jun 2009 at 2:22pm
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