Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-11-30
3
Medium Priority
?
429 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 101

Accepted Solution

by:
mlmcc earned 2000 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 101

Expert Comment

by:mlmcc
ID: 18051094
Glad i could help

mlmcc
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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. …
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 …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

926 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