When working with basic measures, it is necesary to define the aggregation mode used for the measure. Derived measures do not need this setting since these measures calculate their values for each level in the hierarchy.
Aggregation modes include:
Mode |
Description |
---|---|
Sum |
The sum of all values of the level immediately below |
Max |
The maximum value of the level immediately below |
Min |
The minimum value of the level immediately below |
Average |
The average of all values of the hierarchy leaves. |
Weighted Average |
The weighted average, weighted by the field indicated. |
Count |
The number of rows that match the query filters. |
Elapsed Average |
Corresponds to a special aggregation involving time. |
Standard Deviation |
This kind of aggretation mode is described in the following tutorial |
Example
Consider a hierarchy level with three elements, E1, E2 and E3 and the superior level with the element ET.
Consider also that the leaves are built from 5 rows in the datasources.
The following is the expression used in each aggregation mode when calculation the t value of the ET element:
Mode |
Expression |
---|---|
Sum |
t = (a + b + c) |
Max |
t = Max(a, b, c) |
Min |
t = Min(a, b, c) |
Average |
t = ((a + b + c) / 5) |
Count |
t = 5 |
Weighted Average |
If the field used for weighing has P1, P2 and P3 values for each E1, E2 and E3 element respectively:t = ((a*P1 + b*P2 + c*P3) / (P1 + P2 + P3)) |
Special aggretation modes for Dates
It is possible to define the following special aggregation for Dates:
Last |
Takes the value in the level inmediately below corresponding to the last element in the period. |
---|---|
Dynamic Last |
Takes the value in the level inmediately below corresponding to the last element with data in the period. |
First |
Takes the value in the level inmediately below corresponding to the first element in the period. |
Dynamic First |
Takes the value in the level inmediately below corresponding to the first element with data in the period. |
Average |
Takes the value corresponding to the element according to its standard aggregation mode and divides it between the number of leaves in the Date dimension under the scope of the query. |
Children Average |
Takes the value corresponding to the element according to its standard aggregation mode and divides it between the number of children in the Date dimension under the scope of the query. |
First with Data |
|
Last with Data |
Suppose that there is a date dimension with three levels: Year, Quarter, Month.
Figure on the left shows an example for year 2003 where V1 to V4 represent data from the datasources for an Inventory measure.
Values for the higher levels in the hierarchy are calculated based on the aggregation mode chosen.
The following table shows examples for the measure using the different aggregation modes, along with an explantation of each case.
Aggregation Type |
Values |
Explanation |
---|---|---|
First |
Q1 = NaN Q2 = Apr (v3) 2003 = Q1 = NaN |
Since there is no data for Jan, which would be the first element in Q1, the value for Q1 is set to NaN. |
Last |
Q1 = Mar (v2) Q2 = Jun (NaN) 2003 = NaN |
Q1 equals to Mar (v2), because March is the last element in Q1. |
Dynamic First |
Q1 = Feb (v1) Q2 = Apr (v3) 2003 = Q1 |
Q1 equals to Feb (v1) because February is the first element in Q1 with data. |
Dynamic Last |
Q1 = Mar (v2) Q2 = May (v4) 2003 = Q2 |
Q1 equals to Mar (v2) because March is the last element in Q1 with data. |
Average |
Q1 = (v1 + v2) / 2 Q2 = (v3 + v4) / 2 2003 = (v1 + v2 + v3 + v4) / 4 |
Value for Q1 is the sum of the values of its elements, divided by the number of leaves. |
Children Average |
Q1 = (v1 + v2) / 2 Q2 = (v3 + v4) / 2 2003 = (v1 + v2 + v3 + v4) / 2 |
Similar to the previous case, only that the year is divided by 2 (the two quarters children of the year) |
Note
Averages take into account elements created while building the cube that contain data other than zero.