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!

Next/Previous Subtotal 1

Status
Not open for further replies.

jim1959

Instructor
Feb 12, 2007
2
US
I have a simple report with a group on a date field, by month and a subtotal on a currency field. My client wants to show the percent change from one month (subtotal) to the next. The only thing I can think to do is set up a couple of variables and have one reset on odd-numbered groups and the other on even-numbered groups, but that seems kind of clunky. The Next and Previous functions don't seem to like working with summary fields. This seems as though it should be easy to do, but I'm stumped. Thanks.

 
Create a formula like this:

whileprintingrecords;
numbervar prev;
numbervar sumamt := tonumber(sum({table.amt},{table.date},"monthly"));
numbervar chg;

if groupnumber = 1 then
chg := 0 else
chg := (sumamt-prev) % prev;
prev := sumamt;
chg

Place this in a group section along with the summary.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top