ROLLUPGROUP DAX Function (Table manipulation)

Identifies a subset of columns specified in the call to SUMMARIZE function that should be used to calculate groups of subtotals.

Syntax

ROLLUPGROUP ( <GroupBy_ColumnName> [, <GroupBy_ColumnName> [, … ] ] )
Parameter Attributes Description
GroupBy_ColumnName Repeatable

A column to be returned.

Return values

The function does not return a value. It only specifies the set of columns to be subtotaled.

Remarks

The ROLLUP function is used exclusively within SUMMARIZE or ADDMISSINGITEMS.

ROLLUPGROUP can be used to calculate groups of subtotals. If used within SUMMARIZE in-place of ROLLUP, ROLLUPGROUP will yield the same result by adding roll-up rows to the result on the GroupBy_ColumnName columns. However, the addition of ROLLUPGROUP() inside a ROLLUP syntax can be used to prevent partial subtotals in roll-up rows.

» 3 related functions

Examples

--  Using ROLLUPGROUP in SUMMARIZE you can reduce the number 
--  of subtotals by grouping together several columns.
EVALUATE
CALCULATETABLE (
    SUMMARIZE (
        Sales,
        ROLLUP ( ROLLUPGROUP ( 'Date'[Calendar Year], Customer[Education] ) ),
        "Year total", ISSUBTOTAL ( 'Date'[Calendar Year] ),
        "Education total", ISSUBTOTAL ( Customer[Education] ),
        "Amount", [Sales Amount]
    ),
    TREATAS ( { "CY 2008", "CY 2009" }, 'Date'[Calendar Year] ),
    TREATAS ( { "Bachelors", "Partial College" }, Customer[Education] )
)
ORDER BY
    [Year total],
    [Calendar Year]
Calendar Year Education Year total Education total Amount
2008-01-01 Bachelors false false 429,554.13
2008-01-01 Partial College false false 317,811.40
2009-01-01 Bachelors false false 189,037.54
2009-01-01 Partial College false false 173,317.03
(Blank) (Blank) true true 1,109,720.09
--  ROLLUPGROUP can also be used in SUMMARIZECOLUMNS with the same
--  goal: grouping columns together to reduce the number of subtotals.
EVALUATE
SUMMARIZECOLUMNS (
    ROLLUPADDISSUBTOTAL (
        ROLLUPGROUP ( 'Date'[Calendar Year], Customer[Education] ),
        "Year total"
    ),
    TREATAS ( { "CY 2008", "CY 2009" }, 'Date'[Calendar Year] ),
    TREATAS ( { "Bachelors", "Partial College" }, Customer[Education] ),
    "Amount", [Sales Amount]
)
ORDER BY
    [Year total],
    [Calendar Year],
    [Education]
Calendar Year Education Year total Amount
2008-01-01 Bachelors false 429,554.13
2008-01-01 Partial College false 317,811.40
2009-01-01 Bachelors false 189,037.54
2009-01-01 Partial College false 173,317.03
(Blank) (Blank) true 1,109,720.09

Related functions

Other related functions are:

Last update: Apr 27, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/rollupgroup-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of ROLLUPGROUP? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.