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

formula to sum groups 1

Status
Not open for further replies.

sandy1447

IS-IT--Management
Feb 26, 2008
10
US
Have a report using groups and running totals; need to calculate sums for only 2 of the 5 groups.
Example:
Group 1
ID test user case #
333 glucose RSmith 1
333 chol DWills 0
333 T4 SHall 1

Group 2
ID test user case #
444 glucose RSmith 1
444 chol DWills 1

Group 3
ID test user case #
777 glucose RSmith 1
777 chol DWills 0

I'm summing Case # running totals for each group.
Need to add sum of running totals of groups 1 and 3 ONLY in the report footer. Using Crystal v 9
 
I can't tell at what level the running total is being evaluated. I'm assuming that you have one group field with five group instances. How is the running total set up?

-LB
 
Yes, sorry, 1 group with 5 instances...
The running total is a formula field called @glutotal, counting occurence of glucose:
If {test} = "glucose" and
and {PROC_TYPE} in ["CHEM", "RIA"] then 1 else
if {test} = "glucose" and {PROC_TYPE} = "special" then 0

I'm summing this {@glutotal} in each group instance.
 
That's actually not a running total--it is a conditional formula. You can create another formula like this, assuming your group is on ID and that you are wanting to sum IDs 333 and 777:

if {table.ID} in [333,777] then(
If {test} = "glucose" and
{PROC_TYPE} in ["CHEM", "RIA"] then
1 else
if {test} = "glucose" and
{PROC_TYPE} = "special" then
0
) else 0

Place this in the detail section and insert a sum on it at the grand total level.

-LB
 
Thanks, lbass! Your solution was perfect.
I actually search for your solutions on this site, your explanations are always clear, concise and correct!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top