Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

distinct count of gender

Status
Not open for further replies.
Feb 4, 2009
137
US
Hello all, please help me with calculating the distinctcount of gender based on the results below. I'm very appreciated and thank you very much.

Detail Data Results:
PatientID Gender Code VisitDate
1 1 D1201 1/1/2011
1 1 D1202 1/1/2011
1 1 D1203 1/1/2011
1 1 D1204 1/1/2011
2 2 D1201 1/5/2011
2 2 D1202 1/5/2011
3 1 D1202 1/8/2011
3 1 D1204 1/8/2011
4 1 D1203 1/12/2011
5 1 D1201 1/14/2011
6 2 D1203 1/15/2011
6 2 D1203 1/15/2011
I created a report using crystal report 11 get the total count of each cod during a period run from 1/1/11 to 1/15/11…
So I had this working fine in group footer such as….
Code TotalCount
D1201 3
D1202 3
D1203 4
D1204 2
My problem is I need to calculate the gender of total 6 patients have seen during that period, how do I get the total count of gender such as
Male (1) = 4
Female (2) = 2

Again, thanks alots.
 
You could either use running totals that use a distinctcount of Patient ID, evaluate using a formula:

{table.gender} = 1 //2 for females

reset never (or reset on change of group for a group footer)

Or you could create conditional formulas like this:

if {table.gender} = 1 then
{table.patientID} else
tonumber({@null}) //if patientID is a string, remove tonumber()

...where {@null} is a new formula that you open and save without entering anything. Repeat for females. Then place the formulas in the detail section and insert a distinctcount on them at whatever level you like.

-LB
 
Thanks lbass...awesome...it works great...Again, thank you very much...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top