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!

Sum a formula used in a group

Status
Not open for further replies.

RustySunset

Technical User
Mar 17, 2004
18
0
0
US
Using Crystal X with a SQL database.

I'm working on a salesperson commission report. I have details about invoices, commission amount by invoice and payment info. There are two groups - {table2.SperID} is group 1 and {table2.OrderID} is group 2. I have a calculation at the second group {table2.OrderID} to calculate the remaining commission for each order based on the total commission for the order, less the commission paid on this report. My formula in the {table2.OrderID} group footer is; {table1.Sper1_Rate} - Sum ({@Prior_Comm_Pd}, {table2.SperID}) - Sum ({@Current_Comm_Amt}, {table2.SperID})

I would like to have a group sum total at the {table2.SperID} group #1 but the when I attempt to insert the sum I can't pick sum...just max, count, min etc.
 
You can use a variable. Create three formulas:

//{@reset} to be placed in GH#1:
whileprintingrecords;
numbervar grp1sum;
if not inrepeatedgroupheader then
grp1sum := 0;

//{@accum} to be placed in the Group #2 header or footer section:
whileprintingrecords;
numbervar grp1sum := grp1sum + {@yourformula};

//{@display} to be placed in a Group #1 footer section:
whileprintingrecords;
numbervar grp1sum;

If your formulas result is a currency, change 'numbervar' to 'currencyvar' in all formulas.

-LB
 
lbass:

Thanks for the response. I need to make couple more changes before I can try out your advice. I appreciate it and will post a reply after I get a chance to try it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top