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!

manual running total sum help needed

Status
Not open for further replies.

fancyface

IS-IT--Management
May 17, 2006
104
CA
I know how to do a manual running total when I consistently want say the most recent 3 amounts. But how do I do one when I don't know how many amounts/rows will be there for each id? I'm using Crystal 7 - desparately need some assistance
 
I've never used anything older than 8.5. That would allow both a summary count and a running-total count for a group, so you could test if the difference was 3 or less. Does this help?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
If you're doing a manual running total, I assume you're using shared variables. What you can do is set up three variables and "bubble" the numbers thru as you read them.
Something like this>

//@init
shared numbervar last1 := 0 ;
shared numbervar last2 := 0 ;
shared numbervar last3 := 0

on the detail line
//@eval
shared numbervar last1;
shared numbervar last2;
shared numbervar last3;
(last3 := last2 ; last2 := last1; last1 := {table.field})

then at the end you just add those three
 
I'm sorry - I don't know what I was thinking when I posted that message. I don't wants the most recent 3 amounts, I want the most recent 12 month period of amounts. My problem is I have no idea when the most recent date of giving was. It could be a month ago, a year ago, 2 years ago....
 
If you have a date minimum or maximum, you could use DateDiff to work back from there. At least you could in 8.5

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top