Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Mid Sub- Total of a column in Power BI

Hi Everyone,  I'm trying to reproduce this image in Power BI but struggling to get the column' Sub-sector' right How do I get the ' subtotal' of the 1st segment while the remaining segments remains as its shown. Please helpHelp.JPG

1 ACCEPTED SOLUTION
technolog
Super User
Super User

Here are the general steps you can follow to achieve this in Power BI:

1. Data Preparation: Ensure that your data model has a column that can be used to identify the different segments within your 'Sub-sector' column. If such a column does not exist, you may need to create it.

2. Creating Subtotals: You can create subtotals by using DAX measures in Power BI. For example, you can create a measure that sums the values for a particular segment:

Subtotal Measure = CALCULATE(SUM('Table'[ColumnName]), 'Table'[Sub-Sector] = "Specific Segment")

Replace 'Table' with your actual table name and 'ColumnName' with the field you want to sum.

3. Matrix Visual: Use the Matrix visual to display your data. In this visual, you can drag your 'Sub-sector' into the Rows area and your measures into the Values area.

4. Row Grouping: In the Matrix visual, you can turn on the 'Subtotals' option for row groups. You can manage the visibility of the subtotals in the formatting options of the Matrix.

5. Conditional Formatting: If you need the subtotals to stand out, you can apply conditional formatting to the Matrix visual to differentiate the subtotal rows from other rows.

6. DAX for Conditional Subtotals: If the subtotal needs to be conditional (i.e., only for certain segments), you may need a more complex DAX measure that uses logic to determine when to calculate a subtotal vs when to just show the sum for the category.

7. Custom Visuals: If the built-in functionality of Power BI doesn't meet your needs, you might want to explore custom visuals that are available in the Power BI visuals marketplace that could offer more sophisticated grouping and subtotal features.

Here is an example of a conditional subtotal measure:

Subtotal Measure = IF( HASONEVALUE('Table'[Sub-Sector]), SUM('Table'[ColumnName]), CALCULATE( SUM('Table'[ColumnName]), FILTER( ALL('Table'[Sub-Sector]), 'Table'[Sub-Sector] = "Specific Segment" ) ) )

This measure checks if there is only one value in the 'Sub-Sector' (meaning it's a detail row), it will just sum the column. If there are multiple values (meaning it's a subtotal row), it will calculate the sum for a specific segment.

Remember, the specific DAX formulas and approach may vary depending on the structure of your data and the specific requirements of your report. 

View solution in original post

1 REPLY 1
technolog
Super User
Super User

Here are the general steps you can follow to achieve this in Power BI:

1. Data Preparation: Ensure that your data model has a column that can be used to identify the different segments within your 'Sub-sector' column. If such a column does not exist, you may need to create it.

2. Creating Subtotals: You can create subtotals by using DAX measures in Power BI. For example, you can create a measure that sums the values for a particular segment:

Subtotal Measure = CALCULATE(SUM('Table'[ColumnName]), 'Table'[Sub-Sector] = "Specific Segment")

Replace 'Table' with your actual table name and 'ColumnName' with the field you want to sum.

3. Matrix Visual: Use the Matrix visual to display your data. In this visual, you can drag your 'Sub-sector' into the Rows area and your measures into the Values area.

4. Row Grouping: In the Matrix visual, you can turn on the 'Subtotals' option for row groups. You can manage the visibility of the subtotals in the formatting options of the Matrix.

5. Conditional Formatting: If you need the subtotals to stand out, you can apply conditional formatting to the Matrix visual to differentiate the subtotal rows from other rows.

6. DAX for Conditional Subtotals: If the subtotal needs to be conditional (i.e., only for certain segments), you may need a more complex DAX measure that uses logic to determine when to calculate a subtotal vs when to just show the sum for the category.

7. Custom Visuals: If the built-in functionality of Power BI doesn't meet your needs, you might want to explore custom visuals that are available in the Power BI visuals marketplace that could offer more sophisticated grouping and subtotal features.

Here is an example of a conditional subtotal measure:

Subtotal Measure = IF( HASONEVALUE('Table'[Sub-Sector]), SUM('Table'[ColumnName]), CALCULATE( SUM('Table'[ColumnName]), FILTER( ALL('Table'[Sub-Sector]), 'Table'[Sub-Sector] = "Specific Segment" ) ) )

This measure checks if there is only one value in the 'Sub-Sector' (meaning it's a detail row), it will just sum the column. If there are multiple values (meaning it's a subtotal row), it will calculate the sum for a specific segment.

Remember, the specific DAX formulas and approach may vary depending on the structure of your data and the specific requirements of your report. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.