Hi All,
I have a dataset with the following fields
Name Value
ABC 100
DEF 150
GHI 180
Now i need to have a calculated field DIFF which will calculate the difference in the value of the current row and the previous row. The report should have the following fields:
Name Value DIFF
ABC 100 NULL
DEF 150 50
GHI 180 30
Any pointers on how to achieve this requirement will help.
Thanks in advance,
Arun
You can do this with a custom function. Place the following, in the Code section of the Report. Using Report Designer this is on the Code tab of the Report Properties Dialog.Private m_previousValue As Integer = 0
Public Function ComputeDifference(currentValue as Integer) as Integer
Dim diffValue as Integer = currentValue - m_previousValue
m_previousValue = currentValue
Return diffValue
End Function
The value for the calculated field:
=Code.ComputeDifference(Fields!Sales_Amount.Value)
|||you can use previous function of the reproting services. these function will give the previous value.
substract the current value from the previous value.
No comments:
Post a Comment