buls Posted April 14, 2014 Posted April 14, 2014 Hi, I am working with Jasper iReport Designer and want to ask how can I calculate an average sum of a column baced 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? Best regards,Vinny
sadakar Posted April 21, 2014 Posted April 21, 2014 Make use of varialbes for avg . In the variable expressions restirct your avg accroding to dates.For eg:In your variable expression , avg(watt) when date>='01-01-2014' and '01-07-2014' . If take these two values in parameters you can make the expression more generic. Hope this idea will helpful.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now