[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

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

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
DataDesignIT
Asked:
DataDesignIT
  • 2
1 Solution
 
mlmccCommented:
Try this

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

mlmcc
0
 
DataDesignITAuthor Commented:
Perfect! Just what I needed. Thanks.
0
 
mlmccCommented:
Glad i could help

mlmcc
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now