The purpose of an Aggregation node is to apply aggregate functions to measures based on one or several attributes.
A graphical calculation view supports SUM (the default function), MIN, MAX, and COUNT.
SAP HANA Cloud allows you to apply the following additional aggregate functions to the calculation views:
These aggregate functions should be used very carefully in stacked scenarios to avoid incorrect results.
In an Aggregation node, a calculated column is always computed AFTER the aggregate functions. If you need to calculate a column BEFORE aggregating the data from this column, you have to define the calculated column in another node, for example a Projection node, executed BEFORE the aggregation node in the calculation tree.
Defining an Aggregation in the Client Query
When you execute an SQL query on top of a CUBE Calculation View (with or without Star Join), the behavior depends on whether your SQL query includes a GROUP BY clause or not.
- If your SQL query does not include a GROUP BY clause, each requested measure is aggregated as specified in the Semantics of the Calculation View
- If your SQL query includes a GROUP BY clause, the aggregate function you specify for each requested measure overwrites the one defined in the S1emantics of the Calculation View. This provides a lot of flexibility, but can be error-prone in some scenarios. It is recommended to use this with care.