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

Difference between Group totals

Status
Not open for further replies.

lauriesamh

Technical User
Sep 1, 2004
119
US
I'm using CR10 and have a report where I need to get the difference between consective groups.

Group 1 by date of service (table.dos)- displayed as "month/year"
Group 2 by product - suppressed
Detail
Group footer1 Sum of product sales (table.salesamt)

I need to take the difference of the sum of product sales for each group 1. See Example.

Example
Group 1 product Sales (need Difference)
Jan 07 $100 $0
Feb 07 $90 -$10
Mar 07 $250 $160
April 07 $300 $50
...
Current Month year

Any ideas would be much appreciated.
 
I think you need a 'mock-crosstab'. A 'Mock Crosstab' is something that looks like a Crosstab, but in fact you define each column yourself, normally as a running total. This would need to go in the report footer, because running totals count as the reports 'run' and they will not be complete until then. Crystal should have included an example along with the Crosstabs.

You can save a little time by doing a paste to a dummy report, changing the name and then pasting back.

Each running total will count the record if it was within the criteria - in your case, month.

Since each month is a total for the whole report, you can also write formula fields that find the difference between January and February.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hi, My concern is that I can't do a mock crosstab as the report has a date span parameter so the month range could be any span. I was hoping for a formula to setup sometype of running total and comparing to the previous total but I'm getting errors "no previous or next"
 
Try a formula like this:

whileprintingrecords;
currencyvar currtot;
currencyvar prevtot;
prevtot := currtot;
currtot := sum({table.sales},{table.date},"monthly");
if groupnumber = 1 then
0 else
currtot - prevtot;

Place this formula in a group #1 section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top