ROLLUPGROUP

The ROLLUPGROUP function identifies a set of columns specified in the SUMMARIZE function for which that function should calculate subtotals.

Syntax

ROLLUPGROUP(
    groupBy_columnName
    [, groupBy_columnName...]
)

Parameters
  • groupBy_columnName: Field for which the SUMMARIZE function should calculate subtotals.
Returned value

The ROLLUPGROUP function does not return any value.

Additional Information

The ROLLUPGROUP function is only used as an argument to SUMMARIZE or ADDMISSINGITEMS.

Examples

If we start from a data model with tables for sales (Sales), product categories (Category) and geographical locations (Geography), we could create a table calculated with the aggregated values of the sales figure and number of units sold by country and category with the following code:

Tabla = SUMMARIZE(
    Sales,
    Geography[Country],
    Category[Category],
    "Sales", SUM(Sales[Amount]),
    "Units", SUM(Sales[Units])
)

Aggregate table

Now, if we modify the code as follows:

Tabla = SUMMARIZE(
    Sales,
    Geography[Country],
    ROLLUPGROUP(Category[Category]),
    "Sales", SUM(Sales[Amount]),
    "Units", SUM(Sales[Units])
)

...we see how the SUMMARIZE function adds the subtotals for each of the countries grouping all the categories:

Table added with ROLLUPGROUP
Category
Statistical
Submitted by admin on Sat, 07/20/2019 - 17:39