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

Reset a Formula after a group other than Running Total

Status
Not open for further replies.

old123

MIS
Jun 1, 2005
31
US
I have a formula which subtracts current value of the field with the previous value to get a differnce & it is groupwise with a Bus Number

Formula is {FM_300A.FMPMR} - previous({FM_300A.FMPMR})

formula works fine for the first group but the next group first value gets subtracted with the last value of the previous group.

I need to reset the formula after every group.

Here is the sample of the output. NEED HELP as iam very new to Crystal Reports.


PB0001 79243
PB0001 84739 5,496.00
PB0001 90445 5,706.00
PB0001 96393 5,948.00
PB0001 101853 5,460.00
PB0001 107828 5,975.00
PB0001 113590 5,762.00
PB0001 119600 6,010.00
PB0001 125031 5,431.00
PB0001 131078 6,047.00
PB0001 137012 5,934.00
PB0001 142839 5,827.00
PB0001 148605 5,766.00
PB0001 154616 6,011.00
PB0001 160236 5,620.00
PB0001 165870 5,634.00
PB0001 171609 5,739.00

PB0002 108397 -63,212.00
PB0002 113609 5,212.00
PB0002 119590 5,981.00
PB0002 125218 5,628.00
PB0002 130874 5,656.00
PB0002 136585 5,711.00
PB0002 141935 5,350.00
PB0002 147633 5,698.00
PB0002 153687 6,054.00
PB0002 159670 5,983.00
PB0002 165490 5,820.00
PB0002 171302 5,812.00
PB0002 177473 6,171.00
PB0002 183311 5,838.00
PB0002 188964 5,653.00
PB0002 194636 5,672.00
PB0002 200407 5,771.00
PB0002 205613 5,206.00

 
Check against your grouping field

Code:
If {MyTable.Field1} = Previous({MyTable.Field1}) Then
  {FM_300A.FMPMR} - previous({FM_300A.FMPMR})
Else
   0

HTH


Gary Parker
MIS Data Analyst
Manchester, England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top