Using a custom total calculation
In some cases, it is useful to customize the total displayed for a measure. For instance, when calculating the percentage that a measure value makes up of the total of several measures, the sum or the average of all the calculated values in the rows may not be as helpful as the calculating the percentage again based on the measures' overall totals.
|Group||A||B||A / (A+ B)|
Totals calculation rules allow you to customize how the totals are calculated.
2. Creating a custom total formula
This example will add the formula A /(A+B) as the total calculation.
To create a totals calculation rule, click on the measure in the Data Analysis Panel to open its measure configuration dialog, click to expand Totals Calculation Rules for either rows or columns, then click Define totals calculation rule formula.
The formula bar will appear.
There are multiple ways you can determine your totals:
You can pass measures as arguments to functions such as AVG or SUM to determine how the individual values should be totaled. In the example above, the measures A and B both aggregate using Sum, and we will want to use the corresponding SUM function for each measure in order to calculate the overall percentage in this case. You are free to choose functions that don't correspond with the measure's aggregator if needed for your purposes.
Or, you can instead refer to measures directly without calling a function, to use their original totals as determined by their aggregator. When you do this, you have the option of customizing the aggregator used just for this total by clicking on the underlined measure placeholder to open the Placeholder dialog, then setting Aggregator.
Once you complete the formula, click apply to return to the measure configuration dialog. You can then submit the dialog when finished.
3. Other options
There are options available that can influence how the custom total formula is used.
Use Detail Levels – If checked, grand totals use the set of data created from the details level, i.e., the lowest-selected level of the last hierarchy selected. If unchecked, grand totals are calculated using the set of values created from the subtotals.
Grand Totals Only – only applies the formula to the grand total at the beginning or end, and not the subtotals displayed when there are multiple hierarchies selected under Rows or Columns in the metric set.