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!

Distinct sum 1

Status
Not open for further replies.

valo

Programmer
May 23, 2002
8
US
Hi all I a have report with a master->detail relation between two tables, this is invoice issue, all the info is displayed correctly, grouped by invoice but my problem is that the master table contains a special charges field that I need to sum, if the invoice has two or more rows the summary process increments the amount of the special charges field by the number of rows, it is is duplicating the amount, how can I do a distinct sum taking the special amount once by invoice ?

Thanks in advance
 
Create 3 formulas as in:

//Report Header
whileprintingrecords;
global numbervar TheSum:=0;

//Group Footer
whileprintingrecords;
global numbervar TheSum;
TheSum := TheSum+{MyTable.MyValue}

//Group Footer
whileprintingrecords;
global numbervar TheSum;
TheSum

-k kai@informeddatadecisions.com
 
Another option would be to create a running total field.
The field to summarize would be the SpecialCharges field.

The type of summary would be Sum.

You would want to Evaluate on Change of Group for MasterRecordId (you would need to group by some unique field (Id number) in the master record.

You would reset on Change of Group for the group you want to total on (Vendor Id or Customer Id?).

Hope this helps. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top