Subtotal
Returns the subtotal for an aggregate formula.
Usage
Subtotal(aggregate, mode, [parameters])
Arguments
Term | Description |
aggregate |
An aggregate formula Examples: Count(), Sum([Sales Amount]) |
mode |
The mode to use when calculating the aggregate formula. Mode determines which dimension(s) to use when performing the calculation. Mode options vary between element types: General purpose modes
Visualization modes
Pivot table modes
Table modes
|
parameters |
An additional parameter specific to the mode. This is only applicable to the following modes: "column_parent", "row_parent" and "parent_grouping" For these modes, this 3rd parameter specifies how many parent dimensions to ignore. |
Examples
Example #1
Subtotal(Avg([Price]), "column")
- Calculates the aggregate subtotal for each column of the Product Type dimension.
- Verify that the calculation values match the built-in pivot subtotals at the bottom of the table.
Example #2
Subtotal(CountDistinct([Product Type]), "x_axis")
- Calculates the aggregate subtotal for each Product Type, across all values of Store Region.
- The calculation is shown in the tooltip, but is usable anywhere an aggregate formula is allowed.
See Also