简体   繁体   中英

Jasper iReport Designer, weekly average

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM