Defining the aggregation scope
There are usually two factors that together determine which records are used to define the value of aggregation in an expression. When working in visualizations, these factors are:
- Dimensional value (of the aggregation in a chart expression)
- Selections
Together, these factors define the scope of the aggregation. You may come across situations where you want your calculation to disregard the selection, the dimension or both. In chart functions, you can achieve this by using the
Method | Description |
---|---|
|
Using the total qualifier inside your aggregation function disregards the dimensional value. The aggregation will be performed on all possible field values. The TOTAL qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case, the calculation is made disregarding all chart dimension variables except those listed, that is, one value is returned for each combination of field values in the listed dimension fields. Also, fields that are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the drill-down level changes. |
Set analysis | Using set analysis inside your aggregation overrides the selection. The aggregation will be performed on all values split across the dimensions. |
|
Using the TOTAL qualifier and set analysis inside your aggregation overrides the selection and disregards the dimensions. |
|
Using the ALL qualifier inside your aggregation disregards the selection and the dimensions. The equivalent can be achieved with the =sum(All Sales) =sum({1} Total Sales) |
Example: TOTAL qualifier
The following example shows how
Year | Quarter | Sum(Amount) | Sum(TOTAL Amount) | Sum(Amount)/Sum(TOTAL Amount) |
---|---|---|---|---|
3000 | 3000 | 100% | ||
2012 | Q2 | 1700 | 3000 | 56,7% |
2013 | Q2 | 1300 | 3000 | 43,3% |
Example: Set analysis
The following example shows how set analysis can be used to make a comparison between data sets before any selection was made. Assuming that
Year | Quarter | Sum(Amount) | Sum({1} Amount) | Sum(Amount)/Sum({1} Amount) |
---|---|---|---|---|
3000 | 10800 | 27,8% | ||
2012 | Q1 | 0 | 1100 | 0% |
2012 | Q3 | 0 | 1400 | 0% |
2012 | Q4 | 0 | 1800 | 0% |
2012 | Q2 | 1700 | 1700 | 100% |
2013 | Q1 | 0 | 1000 | 0% |
2013 | Q3 | 0 | 1100 | 0% |
2013 | Q4 | 0 | 1400 | 0% |
2013 | Q2 | 1300 | 1300 | 100% |
Example: TOTAL qualifier and set analysis
The following example shows how set analysis and the
Year | Quarter | Sum(Amount) | Sum({1} TOTAL Amount) | Sum(Amount)/Sum({1} TOTAL Amount) |
---|---|---|---|---|
3000 | 10800 | 27,8% | ||
2012 | Q2 | 1700 | 10800 | 15,7% |
2013 | Q2 | 1300 | 10800 | 12% |
Data used in examples: