Solved

How to compare a value in the current row with a value in the previous row?

Posted on 2006-11-30
3
411 Views
Last Modified: 2008-02-01
Experts-

In my report, I want to report on the numeric difference between two values in order to show the delta. For example:

Month 1:  35 widgets   Delta: Unknown
Month 2:  15 widgets   Delta: -20
Month 3:  17 widgets   Delta: +2
Month 4:  22 widgets   Delta: +5

Can I create a formula in Crystal that will do this? (I suppose I need to store the previous row's widget count as a variable, so I can then compare it with the current row's count.) I also need to handle--as the example shows--the first row that won't have a previous row for comparison.

Thanks.
0
Comment
Question by:DataDesignIT
  • 2
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 18047451
Try this

Name - MyDelta
Formula
If (PreviousIsNull({YourQuantityField})) then
  "Unknown"
Else
  ToText({YourQuantityField} - Previous({YourQuantityField}),0)

mlmcc
0
 

Author Comment

by:DataDesignIT
ID: 18048249
Perfect! Just what I needed. Thanks.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18051094
Glad i could help

mlmcc
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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…

730 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