Jump to content
Changes to the Jaspersoft community edition download ×

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


Recommended Posts

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

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...