ROLLUPADDISSUBTOTAL
In SUMMARIZECOLUMNS, adds subtotal rows for columns, with a column saying which rows are subtotals.
Group: Table manipulation. Compatible with DAX.
Syntax
ROLLUPADDISSUBTOTAL ( [<grandtotalFilter>,] <groupBy_columnName>, <name> [, <groupLevelFilter>]
[, <groupBy_columnName>, <name> [, <groupLevelFilter>]] … )
| Parameter | Type | Description |
|---|---|---|
grandtotalFilter | Table optional | A filter for the grand total row only. |
groupBy_columnName | Column repeatable | A grouping column to subtotal, or a ROLLUPGROUP of several. |
name | Text repeatable | The name of the TRUE/FALSE column that marks its subtotal rows. |
groupLevelFilter | Table optional, repeatable | A filter for the subtotal rows of the column before it. |
Returns
No value. It marks the columns SUMMARIZECOLUMNS adds subtotal rows for, and names the columns that flag them.
Remarks
- For each column, SUMMARIZECOLUMNS adds a TRUE/FALSE column of the name given: TRUE on its subtotal rows, where the column itself is blank.
- Several columns in one ROLLUPADDISSUBTOTAL nest: the last is subtotalled within the earlier ones, and the first gives the grand total.
- Grouping columns outside it get no totals: with
Places[Kind]before it, each kind of place gets its own total. - A
ROLLUPGROUPinside it rolls its columns up together, as one level. - It works only inside SUMMARIZECOLUMNS; in
SUMMARIZE, useROLLUP.
Examples
A grand total row
EVALUATE
SUMMARIZECOLUMNS (
ROLLUPADDISSUBTOTAL ( Products[Category], "Is total" ),
"Liters", [Liters sold]
)
ORDER BY [Is total], Products[Category]
| Products[Category] | Is total | Liters |
|---|---|---|
| Beer | FALSE | 1505389 |
| Cider | FALSE | 301074 |
| (blank) | TRUE | 1806463 |
Two nested levels
EVALUATE
SUMMARIZECOLUMNS (
ROLLUPADDISSUBTOTAL ( Products[Category], "Category total", Products[Product], "Product total" ),
"Liters", [Liters sold]
)
ORDER BY [Category total], Products[Category], [Product total], Products[Product]
| Products[Category] | Products[Product] | Category total | Product total | Liters |
|---|---|---|---|---|
| Beer | IPA | FALSE | FALSE | 331884 |
| Beer | Lettøl | FALSE | FALSE | 169179 |
| Beer | Pils | FALSE | FALSE | 1004326 |
| Beer | (blank) | FALSE | TRUE | 1505389 |
| Cider | Cider | FALSE | FALSE | 301074 |
| Cider | (blank) | FALSE | TRUE | 301074 |
| (blank) | (blank) | TRUE | TRUE | 1806463 |
A total within each kind of place
EVALUATE
SUMMARIZECOLUMNS (
Places[Kind],
ROLLUPADDISSUBTOTAL ( Products[Category], "All categories" ),
"Liters", [Liters sold]
)
ORDER BY Places[Kind], [All categories], Products[Category]
| Places[Kind] | Products[Category] | All categories | Liters |
|---|---|---|---|
| Shop | Beer | FALSE | 1505389 |
| Shop | Cider | FALSE | 301074 |
| Shop | (blank) | TRUE | 1806463 |
Related functions
SUMMARIZECOLUMNS, ROLLUPGROUP, ROLLUPISSUBTOTAL, ROLLUP, ISSUBTOTAL.