Solved

# Displaying a gender pie chart in Crystal Reports XI

Posted on 2011-10-01
330 Views
I am returing data from an MS SQL Server database where each row represents a patients visits to a hospital and clinic.

A patient can make many visits so they can be represented by more than one row in the dataset.

I need to count the number of patients. Easy! A distinct count of the patient id field.

I also need to show the percentages of men and women.  And then i need to show this in a pie chart.

This is cause me problems.

It must be a pretty standard problem.  I have tried using running totals, but then i cant show them in the pie chart.

Anyone any ideas how to solve this?
0
Question by:soozh
• 2

LVL 100

Accepted Solution

mlmcc earned 500 total points
ID: 36897479
Try this idea

If {GenderField} = "M" then
{PatientIdField} & " MALE"
ELSE
{PatientIdField} & " FEMALE"

You should be able to use a distinct count on that

If the Patient Id is numeric

If {GenderField} = "M" then
CStr({PatientIdField},0,"") & " MALE"
ELSE
CStr({PatientIdField},0,"") & " FEMALE"

mlmcc

0

Author Comment

ID: 36897547
hej... thats quite clever... let me check it out.
0

LVL 6

Expert Comment

ID: 36899861
Another note: if you need a math formula, the equation is below:

Distinct Count of Males / Distinct Count of Patients = % of Males
Distinct Count of Females / Distinct Count of Patients = % of Females

Once you create these two as formula fields, you can add it to a pie chart as an unlinked subreport and display the pie chart on the order header and anything else you want below it.
0

LVL 100

Expert Comment

ID: 36900446
No need for that.  The chart allows you to display the results as the number or a percent and does it correctly

mlmcc
0

## Featured Post

### 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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.