How to find the difference/variance between previous and current row values in detail band ?

0

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

venkateshreddy080's picture
Joined: Jan 6 2014 - 11:57am
Last seen: 7 months 4 weeks ago

1 Answer:

0

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.

  1. vSalesCurr =  $F{Sales}
  2. vSalesDiff =  $V{vSalesCurr} - $V{vSalesPrev}
  3. 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.

zh3ntil's picture
531
Joined: Nov 19 2014 - 11:02pm
Last seen: 3 years 4 months ago
Feedback
randomness