Jump to content
Changes to the Jaspersoft community edition download ×

How to get Annual Growth rate in Crosstab?


perez08_erich

Recommended Posts

Hi I am new in this and  i would like to ask how to produce annual Growth rate using crosstab?

to make it simple ,in my database it contains the Year, Item,quantity like this:

YEARITEMQUANTITY
2014Book 35
2014Pencil56
2015Book67
2015Pencil50

 

 

now in my report query i filtered it by "YEAR". By creating crosstab i produced something like this:

 $F{Year}Total Quantity Measure
$F{Item}$V{Quantity_measure}$V{Quantity_measure}
   

 

which shows something like this

 20142015Total
Book3567102
Pencil5650106

 

I want to calculate the annual growth rate but cant manipulate the datas by Year as it only produces the total of both years, is there any way i can use the formula for annual growth rate in crosstab?

Can anyone give me a sample template or any info on how to do it? Thank you very much. I want to produce a report output like this:

 

 20142015Growth Rate
Book356791.42%
Pencil5650-10.71%

 

Link to comment
Share on other sites

  • 2 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The problem involves inter-column calculation which Jasper has some difficulty in dealing with.

Suggest using esProc to first prepare the data source and calculate and the growth rate:

A1=mydb.query("select * from store order by item,year")

A2=A1.group(item).run(A1.record(["Growth Rate",item,~(2).quantity/~(1).quantity-1]))

Code explanation is available from http://blog.raqsoft.com/?p=3517.

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...