Dear Team,
Can you please let me know How to find the difference/variance between previous and current row value in detail band?
I created variable with calculation type as Variance and placed this variable in detail band, but it is not giving the correct variance b/w previous and current row values.
Please let me know the steps to solve this issue.
Thanks
Venkatesh
1 Answer:
Posted on May 6, 2016 at 6:27am
Hi,
You can achive this by using 3 variable. For example create variable like below. Sort is important. Beacuse jaspersoft calculates the variable by orders.
- vSalesCurr = $F{Sales}
- vSalesDiff = $V{vSalesCurr} - $V{vSalesPrev}
- vSalesPrev = $F{Sales} (you can define 0 as initial value)
While jasper processing the vSalesDiff,
- vSalesCurr holds current value because it is calculated already
- vSalesPrev holds the previous value because it is not calculated yet and still holds the previous value.
That's the trick.