C1Report supports aggregate expressions in all its calculated fields. The aggregate expressions include all the usual Sum, Avg, Min, Max, Count, Range, StDev, and so on.
All aggregate functions take an expression as an argument and evaluate it within a scope that is determined by their position in the report. For example, aggregates in group headers or footers have the scope of the group. Aggregates in the report header or footer have the scope of the entire report.
For example, the following aggregate expression would return the sum of all values in the Sales field for the scope of the aggregate (group or report): Sum(Sales)
The following aggregate expression would return the total amount of sales taxes paid for all values in the report (assuming an 8.5% sales tax):Sum(Sales * 0.085)
You can reduce the scope of any aggregate using a second argument called domain. The domain argument is an expression that determines whether each value in the current scope should be included in the aggregate calculation.
For example, the following aggregate expression would return the sum of all values in the Sales field for products in category 1: Sum(Sales, Category = 1)
The following aggregate expression would return the number of sales over $10,000: Count(*, Sales > 10000)