• Status: Solved
• Priority: Medium
• Security: Public
• Views: 604

# Crystal Report Help with a Formula- percentage rate

I need to determine the death rate.

How do I set up the formula for #death/#people for a percentage rate?

Do I make 2 people tables

my code for a death is "9" and all other are living.

so how do I work it to find only the people with a code of "9" divided by all people?

0
Namrac00
2 Solutions

Commented:
You can create 1 formula to give you a field that allows you to get the dead count:

if {table.code} = "9"
then 1
else 0

You can then create a second formula to perform the % calc:

//@Death Rate
if sum({table.field}) = 0
then 0

This gives you an overall percentage.
You would of course need to update the examples above with the actual fields you are using.
0

Author Commented:
Should the {table.field} be the people table?

If I run a seperate report to pull at the dead people with the same criteria I get 1530 as the count

the current report with it broken down to a specific place and code I get 555.

The formula above is giving me a percentage of 22.93

and if I do the manual dividing 555 into 1530 = 36.27?
0

Commented:
You need to count all the people living and dead that meet your criteria (don't use the table.code = 9)
Use bd's formula to count the dead people

The divide the 2

mlmcc
0

Commented:
Create the following formulas in your report.  Add the first 3 to the details section (you can always suppress those that you don't actually want visible in your report).  Then add the Dead Percentage Grand Total formula to your Report Footer section to see the overall Dead Percentage.

//@Num Alive
if {YOURTABLENAME.CODE} <> "9"
then 1
else 0

if {YOURTABLENAME.CODE} = "9"
then 1
else 0

if ({@Num Dead} + {@Num Alive}) > 0
else 0

if sum({@Num Dead} + {@Num Alive}) > 0
else 0

Jeff
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.