How to calculate SUM ??

Hey guys!
I have a scenario in which i want to display Sales for each day.
On any specific day, there can be 1 or more then 1 sales.
I thus need to show the SUM of sales on that particular date too.

What i did was, i arranged the result on ireport as Grouped by on Date.
But, i am confused as how would i show the total for each date.

I would sure appreciate any help.
umair's picture
515
Joined: Mar 10 2008 - 12:04am
Last seen: 15 years 6 months ago

3 Answers:

In iReport you can create a variable with the calculation type sum on the sales field.

The reset type of your variable should be "Group" and the reset group should be "Date". Now your variable sum will reset each time the group changes.

Finally you can write out this variable in the footer of the "Date" group to display the group sum before the reset.

One note, ensure you data is sorted (can be done in with the JR sorting option, or in the SQL if your report has an SQL query) by date field to ensure the grouping is inclusive across your data.

HTH
lshannon's picture
2648
Joined: Feb 2 2007 - 3:54am
Last seen: 9 years 6 months ago
I appreciate your help.
It works fine now. Thanx a lot
umair's picture
515
Joined: Mar 10 2008 - 12:04am
Last seen: 15 years 6 months ago

One note, ensure you data is sorted (can be done in with the JR sorting option, or in the SQL if your report has an SQL query) by date field to ensure the grouping is inclusive across your data.


I am kinda new to Jasper, iReports...
How do you sort them??:blush:
umair's picture
515
Joined: Mar 10 2008 - 12:04am
Last seen: 15 years 6 months ago
Feedback