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

how to calculate the difference

Status
Not open for further replies.

jmd0252

Programmer
May 15, 2003
667
OK I have a meter readings file, to keep it simple. Date and meter reading. So I got say 6 records,, How on the crystal report do I calculate the difference,,from one meter reading to the next..

file would look like this
2009/01/01 123456
2009/02/01 123987
2009/03/01 124025

Ideas,, suggestions,, solutions..
 
Create a formula like this:

if not onfirstrecord then
{table.value}-previous({table.value})

-LB
 
ohhhhhhhhh,,, that works nicely,,, now,

The readings are "group", by account, so how do I get it to calculate it within the group only,, and not keep going?? The calculation needs to "reset". each time the group changes.
 
if not onfirstrecord and
{table.groupfield} = previous({table.groupfield}) then
{table.value}-previous({table.value})

-LB
 
Outstanding simplely outstanding,, where did you find the "previous"??
 
It was two rows behind the "next" :). Look in the functions list in the formula editor->print state->previous. You can learn a lot about CR just by scrolling through the functions list and checking out the related Help files.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top