Question

I am working with iReport Designer and want to ask how can I calculate an average sum of a column based on a date?

I am working on a report which has a database containing a table two columns: 1st is "sample_time" which has DATE values and the second is a "watt" which has an int value.

What I want to do is take the "watt" column and show it as average on the report (which I can do), and then show the same column "watt", but from averages based on the dates from the other "sample_time" column.

Lets say I have the dates from 2008-01-01 to 2008-01-20 and I want to do a weekly average, lets say from 01-01 to 01-07, how can I do that?

Was it helpful?

Solution

Well, i think this can get easily achieved using JasperReports Groups. You can create a group based on you sample_time column, and calculate the average for each group (which means, for each date, its just like doing a group by on a SQL query). Here there are two quick tutorials: JasperReports Groups || The Groups

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top