Dax Function: ROLLUPADDISSUBTOTAL

Category: Table Manipulation Functions

The ROLLUPADDISSUBTOTAL function in Power BI is a specialized DAX function that enhances the ROLLUP function by adding an indicator column to specify whether a row is a subtotal or a grand total. This additional functionality helps users identify and handle subtotal rows explicitly in calculations and visualizations.

Purpose

  • Identify Subtotals: Adds a column to distinguish subtotal and grand total rows from regular rows.

  • Streamline Reporting: Facilitates the customization of subtotal handling in reports.

  • Enhanced Filtering: Makes it easier to filter or style subtotal rows in tables and visuals.

Type of Calculations

  • Hierarchical grouping with subtotals.

  • Marks subtotal and grand total rows for enhanced usability.

Practical Use Cases

  1. Financial Reports: Highlight or filter subtotal rows in income or expense reports.

  2. Sales Dashboards: Separate subtotals and grand totals for visual emphasis.

  3. Custom Calculations: Apply specific formulas or styling to subtotal rows.


ROLLUPADDISSUBTOTAL ( <table> )</table>

ParameterTypeDescription
tableTableThe table or expression to which the ROLLUP function is applied.

How Does ROLLUPADDISSUBTOTAL Dax Works

  1. Applies ROLLUP Logic: Groups the input table and calculates subtotals at each hierarchical level.

  2. Adds IsSubtotal Column: Appends a boolean column (TRUE/FALSE) to indicate whether a row is a subtotal.

  3. Combines Data: Outputs the original table along with the new column for subtotal identification.

Key Characteristics

  • The IsSubtotal column enables more control in identifying and handling subtotal rows.

  • It does not modify the original data but augments it with additional insights.

What Does It Return?

  • Table: A table that includes all the rows of the input table, augmented with:

    • Grouped rows with subtotals and a grand total.

    • An additional column named IsSubtotal indicating:

      • TRUE for subtotal or grand total rows.

      • FALSE for regular rows.

When Should We Use It?

  • Custom Styling: Apply formatting or styles specifically to subtotal rows in Power BI visuals.

  • Advanced Filtering: Filter subtotal rows for customized calculations or visual display.

  • Complex Reporting: Simplify the management of hierarchical subtotals in financial or operational reports.

Examples

Basic Usage :

Identify subtotals in sales data:


ROLLUPADDISSUBTOTAL ( Sales )

Result: Adds an IsSubtotal column to the sales table, marking subtotal rows as TRUE.

Column Usage

Apply custom formatting to subtotals in a table visual:

  • Create a measure:


Subtotal Style =
IF ( SELECTEDVALUE(Sales[IsSubtotal]), "Bold", "Normal" )

  • Use this measure to format rows in your visual.

Advanced Usage

Calculate a custom subtotal adjustment:


ADDCOLUMNS (
ROLLUPADDISSUBTOTAL ( Sales ),
"Adjusted Total",
IF ( [IsSubtotal], [Amount] * 1.1, [Amount] )
)

Result: Calculates an adjusted subtotal amount, increasing it by 10%.

Tips and Tricks

  • Use IsSubtotal for conditional formatting in Power BI visuals.

  • Combine with ADDCOLUMNS for advanced calculated columns.

  • Dataset Size: Applying this to large datasets can be resource-intensive.

  • Visual Clutter: Subtotal rows may overwhelm visuals if not managed properly.

Performance Impact of ROLLUPADDISSUBTOTAL DAX Function:

  • Optimize by using filters to limit the scope of data.

  • Consider pre-aggregating data for large tables to improve query performance.

Related Functions You Might Need

FunctionDescription
ROLLUPGenerates hierarchical subtotals and grand totals.
SUMMARIZEGroups data by specified columns and aggregates.
ADDCOLUMNSAdds calculated columns to a table.
ISINSCOPEDetermines the current row context in hierarchical data.

Want to Learn More?
For more information, check out the official Microsoft documentation for ROLLUPADDISSUBTOTAL You can also experiment with this function in your Power BI reports to explore its capabilities.

Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.

1. What is the ROLLUPADDISSUBTOTAL function in Power BI?

It is a DAX function that calculates subtotals and adds an IsSubtotal column to indicate subtotal or grand total rows.

2. How is ROLLUPADDISSUBTOTAL different from ROLLUP?

ROLLUPADDISSUBTOTAL includes an additional IsSubtotal column, making it easier to identify subtotal rows.

3. Can I customize subtotal rows using this function?

Yes, you can use the IsSubtotal column for conditional formatting or custom calculations.

4. Is this function resource-intensive?

For large datasets, it can impact performance. Pre-filter or optimize data for better results.

5. How do I filter only subtotal rows?

Apply a filter where IsSubtotal = TRUE to display or process only subtotal rows.