Problem source: http://community.jaspersoft.com/questions/847490/how-get-annual-growth-rate-crosstab
As every column in a crosstab is generated dynamically, you also need to reference them dynamically when performing inter-row calculations. There is some difficulty in handling this dynamic reference using a Jasper script. But the data preparation can be made easier using esProc. Let’s look at an example.
A1: Retrieve records from the store table.
A3: Return A2’s result to the report. Reporting tools will identify esProc equipped with JDBC interface as a normal database.
Below is a preview of the finished report:
A report calls an esProc script in the same way as it calls the stored procedure. Save the above script as AnnualRate.dfx. You can invoke it with call AnnualRate () and input parameters into it from Jasper’s SQL designer.