Displaya table with Column total and row total

-1

I need to display he data in the following format

 

  2001 2002 2003 2004.... sum
data1 10 20 10 10 50
data2 20 20 20 20 80
data3 30 20 20 30 100
sum 60 60 50 60  

My sql query is

 

select year, data1, data2,data3 from table1. Year data1,data2,data3 are allseparate columns in the table. Cross tab does not help in this case

AnnMary.Thomas's picture
Joined: Jun 18 2014 - 4:41am
Last seen: 2 years 5 months ago

1 Answer:

0

The column total is very easy, just drop your fields in the column footer and JasperSoft studio will ask you if you want to agregate the result (select SUM) and will create the proper variables for you.

For the row total create a variable, let say ROW_TOTAL and in the variable  expression add all the fields you want to add i.e.: $F{sales-01} + $F{sales-02} +$F{sales-03}.... and then in the last column just print your variable $V{ROW_TOTAL}

For more info on working with variables, look at chapter 9 in the JSS user guide http://community.jaspersoft.com/documentation/v56/jaspersoft-studio-user...

marianol's picture
4217
Joined: Sep 13 2011 - 8:04am
Last seen: 5 months 2 weeks ago
Feedback
randomness