When you create calculated fields in the QuickReports designer, their values are calculated on the base of individual data source rows. Then, when this calculated field is used in any dashboard widget, you apply selected summary function to it.
Let's take Translation jobs table as data source and create new calculated field called Amount per hour. Using expression builder you can quickly build the following expression for this calculated field:
[Amount (base cur)] / [Edit time (minutes)] * 60
This calculated field allows to get earned amount per hour for each job. If to drag this column to a Table, Chart, Pivot table or any other widget, you will be able to select summary function for this field:
On provided screenshot you can see that Amount (base currency), Edit time (minutes) and Amount per hour fields were put onto Values section of the pivot table, and Date field was put into Rows section. Average amount per hour is calculated by summing this value for each job in specified year and dividing it by a number of jobs. Because of that, applying provided expression to summary values shown on the screenshot won't give value in the last column.
To calculate expression on a summary level, right click on a calculated field, select Edit expression, expand Functions node and select Aggregate functions:
Here you can select from a number of aggregate functions to calculate your values on a summary level. For example, provided expression may be turned into:
Sum([Amount (base cur)]) / Sum([Edit time (minutes)]) * 60
Resulting table will get different values:
For the first row, 6626.96 / 15028 * 60 gives 26.46. Amount per hour is now calculated for the summary values, not as average of jobs.
You can use any of the following predefined aggregate functions within the QuickReports Designer:
- Avg() - Returns the average of all values in the expression.
- Count() - Returns the number of values.
- CountDistinct() - Returns the number of distinct values.
- Max() - Returns the maximum value across all records.
- Min() - Returns the minimum value across all records.
- Sum() - Returns the sum of all values.