eriksson.henrik Posted January 20, 2015 Share Posted January 20, 2015 Hi!I've made a crosstab that display sales by month and year. Now I need to calculate the differece against last years total. Any suggestion how to do this? janfebmar...TotalDifference last year2012123213123412...111231 2013123213213123...1231231??? (Total 2013 - total 2012) 201412321313213...123123??? (Total 2014 - total 2013) Link to comment Share on other sites More sharing options...
rajesh.sirsikar Posted January 20, 2015 Share Posted January 20, 2015 Hi Henrik,Please follow the steps as below.1) Create a Variable "Previous_Value" and in the expression Window write $V{Current_Value}.2) Now Create Variable "Current_Value" and choose the Field "Total"3) Now Create the Diff Variable with Expression $V{Current_Value}-$V{Previous_Value}The Trick here is to create Previous Value field first so that Jasper runs it first at the runtime.Check My blog http://www.rajeshsirsikar.com/subtract-current-value-from-previous-value-in-jaspersoft-studio/ for Images and Info.Please Up -Vote If you find this answer useful.Thanks,Rajesh Sirsikar Link to comment Share on other sites More sharing options...
eriksson.henrik Posted January 20, 2015 Author Share Posted January 20, 2015 Thanks for your help!In step 2, how do I add the field "Total"? (It's calculated by the crosstab and $V{measure1}) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now