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

running total on formula result

Status
Not open for further replies.

jwaldner

Programmer
Jan 21, 2011
77
US
I have a formula like this:
DateDiff('s', Minimum({Command.StartTimeStamp}, {Command.KEY}), Maximum({Command.EndTimeStamp}, {Command.KEY}))

it returns the seconds between the start and end of an event i have.
Works great.

but i need a total of this time so I can do average time [in the footer], I get this field cannot be summarized when I try and total it and run an average. I know it's because of the Maximum and Minimum in the formula. is there a way I can add the results of this formula to a running total or something and still be able to use the formula for what I need it for. Or do I need a different tactic?

thanks!
joe
 
You will need to use variables to achieve this. Replace your existing formula with the following:

Code:
WhilePrintingRecords;

Local NumberVar s := DateDiff('s', Minimum({Command.StartTimeStamp}, {Command.KEY}), Maximum({Command.EndTimeStamp}, {Command.KEY}));
Global NumberVar SECS := SECS + s;

s

Then, in the Report Footer you can use the variable SECS to return the total seconds and as the basis for the average.

Hope this helps.

Cheers
Pete
 
Thanks, this looks like it is just what I need. I'll take it for a spin!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top