Solved

Crystal Report Help with a Formula- percentage rate

Posted on 2006-11-28
4
586 Views
Last Modified: 2008-02-01
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?

Thanks in advance.
0
Comment
Question by:Namrac00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 28

Assisted Solution

by:bdreed35
bdreed35 earned 250 total points
ID: 18029953
You can create 1 formula to give you a field that allows you to get the dead count:

//@Dead
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
else sum({@Dead}) % sum({table.field})

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 Comment

by:Namrac00
ID: 18031374
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 18032450
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
 
LVL 2

Accepted Solution

by:
badstink earned 250 total points
ID: 18040159
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

//@Num Dead
if {YOURTABLENAME.CODE} = "9"
then 1
else 0

//@Dead Percentage
if ({@Num Dead} + {@Num Alive}) > 0
then 100 * {@Num Dead} / ({@Num Dead} + {@Num Alive})
else 0

//@Dead Percentage Grand Total
if sum({@Num Dead} + {@Num Alive}) > 0
then 100 * sum({@Num Dead}) / sum({@Num Dead} + {@Num Alive})
else 0


Jeff
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question