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

Totaling top records after for 1

Status
Not open for further replies.

vblack7770

Programmer
Apr 11, 2005
26
US
I have created a report and used the following formulas to get the top 2 records for each group.

Formula 1 - whileprintingrecords;
numbervar RowCount:=0;

Formula 2 - whileprintingrecords;
numbervar RowCount:=RowCount+1;

Now that I have those top 2 $ amounts, I would like to get the difference between the two. Of course, using the normal sum and total will only get the sum or total for all records. I just want the difference between the two I have showing. Any suggestions?
 
Assuming you are comparing detail level records, you could use a formula:

{table.amt} - next({table.amt})

If you have your records sorted so that first two records in the group are the top 2, then you should be able to use this formula in the group header--if you want to display the result at the group level.

-LB
 
You Rock!! I would have never guessed to use the Next function as I have never used it in the 6 years I have been doing reports. Thanks so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top