Newbie: How to calculate percentage

By: Ravi - ers_sg
Newbie: How to calculate percentage
2003-11-26 20:56
Hi all,
I've just come across Jasperreport and am trying to see if I can use it. I would like to ask how to carry out calculations that require values of both the current record and an aggregation of all records down the column.

For eg. suppose I'm reading in 2 fields:
Customer Name, Amt. of Sales

In the detail band, I can print out these values record by record. I can also add the sum of all sales at the bottom of the column. But how do I add a 3rd column in the detail band, showing for each record its value as a percentage of the whole? i.e. (Amt. of sales/sum of sales) for each record.


By: Teodor Danciu - teodord
RE: Newbie: How to calculate percentage
2003-11-28 11:12


This is not possible for the moment in JasperReports.
Or at least it is not easy to do.
The best approach would be to supply within
the datasource the totals already calculated and let
the reporting engine deal only with the percentage.

There are some possible solutions that would bring
such functionality to JasperReports in the future.
But until then...

I hope this helps,
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 7 months ago

0 Answers:

No answers yet