0
votes

I 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

Each of the car color Running Total distinct count fields has a formula behind it to give us the number for that color, 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

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.

1

1 Answers

0
votes

After working with this for some additional time, I was able to find the solution. I created a new formula for each of the car colors and was able to divide using the Running Total distinct count field for each, and then times by 100 to move the percentage 2 decimal places. So an example of a formula was:

{BLACK CARS}/distinctcount({Command.CARS}) * 100

I created one of these for each car color and placed them next to the distinct count fields.