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!

Difference between previous group total

Status
Not open for further replies.

sankyu

Programmer
May 19, 2011
1
IT
Hi, i'm new in this forum, i need something like this:

pippo
1/2011 sell: 2
2/2011 sell: 4 MonthVariation: +2
total:6

it's possible to do this in crystal report or i need to do it in database stored procedure?
all the field are group fields by name and sub group by month
the total is a grand total; im' using crystal report for vs2010

Thanks to all
 
You can do this using variables. Collect in one group, then in the group footer, move this value to a 'Previous Group' field and clear for the next group.

The use of Crystal's automated totals is outlined at FAQ767-6524. In this case, only the defined variables can be used.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Create a formula like this for the difference:

//{@diff} to be displayed in the month group section:
whileprintingrecords;
numbervar amt;
numbervar prev := amt;
amt := sum({table.amt},{table.date},"Monthly");
amt - prev

//{@reset} to be added to the name group header:
whileprintingrecords;
numbervar amt;
numbervar prev;
if not inrepeatedgroupheader then (
amt := 0;
prev := 0
);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top