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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum using multiple conditions

Status
Not open for further replies.

TiggerMom

Programmer
Dec 13, 2000
15
CA
I need to create a formula that adds up all the DosageAmounts for a PatientID by DrugName. My report is grouped by DrugName.

I want the report to look like:

GROUP: DrugName

GROUP: DailyDosageGrouping (0 mg - 10 mg, >20 mg)

DETAIL: PatientID#43 DosageAmount 10 mg
(supressed) PatientID#43 DosageAmount 5 mg
PatientID#43 DosageAmount 20 mg
PatientID#600 DosageAmount 8 mg
PatientID#2 DosageAmount 2 mg
PatientID#2 DosageAmount 10 mg

DailyDosage #Patients %ThisDrug'sPatients vgDailyDose
0 mg - 10 mg 1 33.3% 8 mg
>20 mg 2 66.6% 23.5 mg

Is there a way to sum up the dosageamounts for a patient then apply that value to the DailyDosageGroup formula so that I can get my final numbers at the bottom of the report? I can't see anything in the Help files about summing beyond using one condition...I have two conditions.

I am using Crystal 7 with SQL7 backend.
 
Add a group by patientID, and sum the dosage for each group to get the total dosage per patient.

Then create a running total that does a distinct count of the PatientID. In the "Evaluate" condition put:

Sum({Dosage}, {PatID}) < 10

Repeat with another running total field for each category you need. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top