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

Sum formula on groups 1

Status
Not open for further replies.

josephwc

Programmer
Oct 13, 2005
83
US
In Crystal 11 I have a formula field called {@30dayavail}which is the equation shown below. This formula takes the greatest stop date value from the details for each person to see if it falls within a 30 day time period. If it does the "name" group shows a 1 otherwise a 0.
How do I summarize the ones and zeros at higher level groups?

if maximum({qrystaffing.stop},{qrystaffing.name})< currentdate + 30
then
1
else
0



 
You could do this using variables, as in the following formulas, where your formula is called {@in30days}:

//{@resetgrp1} to be placed in the group header #1:
whileprintingrecords;
numbervar grp1sum := 0;

//{@resetgrp2} to be placed in GH#2:
whileprintingrecords;
numbervar grp2sum := 0;

//{@accum} to be placed in GH#3 (name group):
whileprintingrecords;
numbervar grp1sum := grp1sum + {@in30days};
numbervar grp2sum := grp2sum + {@in30days};

//{@displgrp2} to be placed in the GF#2:
whileprintingrecords;
numbervar grp2sum;

//{@displgrp1} to be placed in the GF#1:
whileprintingrecords;
numbervar grp1sum;

This assumes you have three groups.

-LB
 
Thank you. That worked great! The help is greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top