{{getMsg('Help_YouAreHere')}}:
/
{{page.title}}
{{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}}
{{helpModel.downloadHelpPdfDataStatus}}
Create Report with Grouping and Summation
In this example we will show how to make a simple report using grouping and summation. Therefore we use a simple table with 2 columns only. The table looks like this:
groupcolumn | sumcolumn |
---|---|
A | 12 |
A | 23 |
B | 15 |
B | 21 |
B | 24 |
C | 11 |
C | 17 |
C | 44 |
What we want to do is to group the data on the column groupcolumn and sum the values in column sumcolumn for each group. The expected result should look like this.
groupcolumn | sumcolumn |
---|---|
A | 35 |
B | 60 |
C | 72 |
First we create a report without a database connection. After we have done this our field browser does contain our two columns now.
Now we group the data in the first column. Therefore we add a group using the group dialog.
-
Use the menu "Insert | Group" or click the toolbar button to get there.
-
Click "Add" to add a new group.
-
Select a field to group by clicking the Grouping combo box.
-
Click "OK" to confirm all group settings and close the dialog.
After this we will add a sum.
-
Create a new summary field by using the context menu of the Field Browser element "Summary Fields".
-
Select the field to sum (in our case sumcolumn) and click the highlighted arrow button next to "Field to summarize".
-
Select the group for which the sum should be calculated (in our case group # 1) and click the highlighted arrow button below "Group by:".
-
Don't forget to enter a name for the column ( here: mysum).
Now we just have to add the fields to the editor page. Simply drag group #1 and the sum mysum into the Group Footer area.
As a result you'll get the sum for every group: