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, then click Set up totals calculation rule formula.
The formula bar will appear.
Formulas are entered in a similar way as for a regular formula measure: formula functions and measure placeholders can be used.
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 several options that can influence how the custom total formula is used.
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.
Calculation Axis – determines if the custom calculation applies to the column totals or the row totals.
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.
Aggregator – This aggregation is still applied when grouping and aggregating the individual values, and for totals along the axis opposite that of the totals formula. For example, if Calculation Axis is Columns, this is applied to the total rows. When Grand Totals Only is selected, it is also applied to subtotals of the Calculation Axis.