Solved

Displaying a gender pie chart in Crystal Reports XI

Posted on 2011-10-01
4
331 Views
Last Modified: 2012-05-12
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
Comment
Question by:soozh
  • 2
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 36897479
Try this idea

Add a formula

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

by:soozh
ID: 36897547
hej... thats quite clever... let me check it out.
0
 
LVL 6

Expert Comment

by:Metallimirk
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

by:mlmcc
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now