Avatar of PresidentLincoln
PresidentLincoln
Flag for United States of America asked on

Crystal Reports: Need to get percentages from Running Total distinct counts

have a pre-existing Crystal Report that an end-user wants me to add percentages to. I'm running into an issue because the numbers they want percentages of are Running Total distinct count fields with their own formulas.

At the end of a report, I have several Running Total fields that are distinct counts for cars, one field for a count of each color car. The sum of all of these fields equals a grant total of all cars. So it looks something like this:

Black: 5 
Red: 10
Green: 5
Yellow: 20
Total: 40

Open in new window


Each of the car color distinct count fields has a formula behind it to give us the number, and then the "Total" field is just the distinct count of all cars - no formula.  
I need to automatically calculate and add the percentages of each of the car color rows towards the total count.  It would look like this:

Black: 5    12.5%
Red: 10    25%
Green: 5    12.5%
Yellow: 20    50%
Total: 40

Open in new window


So how can I get these percentages using distinct counts that themselves are already using formulas to get their numbers?  At this point I've tried using the existing formulas used to get the car color counts to next inside a new formula that would divide it by the car total, but I can't seem to get the result I want.

- This is a DB2 database (AIX)
- Using Crystal Reports 14.1.12.2983
Crystal Reports

Avatar of undefined
Last Comment
PresidentLincoln

8/22/2022 - Mon
Arana (G.P.)

its been long sine I used CR, but I would add labels to the report that display the calculations (not as part of the field)
you only have to be able to get the grand total , after the report has been completed so you can calculate the percentages of each of the car colors.
Mike McCracken

Use your color count formulas for the numerator and the count of cars (no color filter) as the denominator

If you need more help post the report

mlmcc
PresidentLincoln

ASKER
@Mike, I wouldn't know how to post the report without posting proprietary information.  I understand what you're saying about which number to use as the numerator and denominator, but how would I do that for each color car?  Would it be a new running total field with something other than a distinct count?  or would it be a formula I could insert next to each field?  Remember, I'm already using a formula in the existing running total fields to get the existing distinct counts.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
PresidentLincoln

ASKER
I have made a couple of small updates to my question to clarify what I'm looking for.
ASKER CERTIFIED SOLUTION
PresidentLincoln

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.