Solved

Calculating the Difference Between Numbers in Consecutive Records

Posted on 2008-06-13
2
556 Views
Last Modified: 2010-08-05
I have a report with data similar to this format:

Customer       Mileage
500                 1000
500                 2000
500                 2200
500                 2500

What need help doing is calculating the difference between the mileages, so it would look like this:

Customer       Mileage        Difference
500                 1000              0                 (since there is nothing to subtract from)
500                 2000              1000            (2000 - 1000)    
500                 2200              200               (2200 - 2000)
500                 2500              300               (2500 - 2200)

I can't seem to figure out how to get that difference to calculate.

Thank you for your help!

0
Comment
Question by:leesmithinc
2 Comments
 
LVL 28

Accepted Solution

by:
bdreed35 earned 500 total points
ID: 21780999
You can write a formula like this to get the difference:

whileprintingrecords;
if not onfirstrecord
then {table.mileage} - previous({table.mileage})
else 0
0
 

Author Closing Comment

by:leesmithinc
ID: 31467001
That worked great.  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question