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
Financial Reports: Highlight or filter subtotal rows in income or expense reports.
Sales Dashboards: Separate subtotals and grand totals for visual emphasis.
Custom Calculations: Apply specific formulas or styling to subtotal rows.
ROLLUPADDISSUBTOTAL ( <table> )</table>
| Parameter | Type | Description |
|---|---|---|
| table | Table | The table or expression to which the ROLLUP function is applied. |
How Does ROLLUPADDISSUBTOTAL Dax Works
Applies ROLLUP Logic: Groups the input table and calculates subtotals at each hierarchical level.
Adds
IsSubtotalColumn: Appends a boolean column (TRUE/FALSE) to indicate whether a row is a subtotal.Combines Data: Outputs the original table along with the new column for subtotal identification.
Key Characteristics
The
IsSubtotalcolumn 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
IsSubtotalindicating:TRUEfor subtotal or grand total rows.FALSEfor 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
IsSubtotalfor conditional formatting in Power BI visuals.Combine with
ADDCOLUMNSfor 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
| Function | Description |
|---|---|
ROLLUP | Generates hierarchical subtotals and grand totals. |
SUMMARIZE | Groups data by specified columns and aggregates. |
ADDCOLUMNS | Adds calculated columns to a table. |
ISINSCOPE | Determines 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.
It is a DAX function that calculates subtotals and adds an IsSubtotal column to indicate subtotal or grand total rows.
ROLLUPADDISSUBTOTAL includes an additional IsSubtotal column, making it easier to identify subtotal rows.
Yes, you can use the IsSubtotal column for conditional formatting or custom calculations.
For large datasets, it can impact performance. Pre-filter or optimize data for better results.
Apply a filter where IsSubtotal = TRUE to display or process only subtotal rows.