Aggregate functions: Max/Min/Sum
Aggregate functions that are available are: Min, Max, Sum. They return the minimum, maximum or average for the set of records taken into account.
The syntax is:
where:
can be Max, Min or Sum is any TGKML expression is any dimension on which the expression is not constant. It's possible to specify more than one dimension (comma separated)
Here an example:
[LO].[90010](Dest2.[GEN]):= Max([50210], Dest2);
The result is obtained starting from the given expression, grouping on all dimension except the one(s) specified. For each obtained row, the amounts are generated calculating the specified aggregation function (maximum, minimum or sum), on all the rows which generated current row.
If the original set of records are
| Entity | Account | Scenario | Category | Dest1 | Dest2 | Period | Amount |
|---|---|---|---|---|---|---|---|
| A00 | 50210 | 2013BDG | $AMOUNT | D11 | D21 | 01 | 20 |
| A00 | 50210 | 2013BDG | $AMOUNT | D11 | D22 | 01 | 45 |
| A00 | 50210 | 2013BDG | $AMOUNT | D12 | D22 | 01 | 30 |
| A00 | 50210 | 2013BDG | $AMOUNT | D12 | D27 | 01 | 25 |
the result is:
| Entity | Account | Scenario | Category | Dest1 | Dest2 | Period | Amount |
|---|---|---|---|---|---|---|---|
| A00 | 90010 | 2013BDG | $AMOUNT | D11 | GEN | 01 | 45 |
| A00 | 90010 | 2013BDG | $AMOUNT | D12 | GEN | 01 | 30 |