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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Mattm1989
Regular Visitor

Which DAX function can I use to group certain accounts to show sub totals of groupings

Hi

 

I want to group the below data so it shows sub groupings for gross profit and gross operating profit using DAX:

 

Mattm1989_0-1729524146708.png

I would like to show Revenue and Cost of sale under "Gross Profit" and Delivery and Operations under Gross Operating Profit so it looks something like the below:


Mattm1989_1-1729524568582.png


Please can someone shed some light on how I can acheive this?

 

Thanks

Matt

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@Mattm1989 You generally use a disconnected table for this, similar to this: The New Hotness (Custom Matrix Hierarchy) - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Your solution is so great Greg_Deckler 

Hi, @Mattm1989 

According to your description and the screenshots shown, in addition to using the Super User method to achieve this goal, you can also refer to the following method:

Since the matrix implements a hierarchical structure, you have the following levels:

vjianpengmsft_0-1729752367550.png

If not, you can increase these calculated columns using the IF condition or the switch function. Set in the matrix as follows:

vjianpengmsft_1-1729752556437.png

If you want to change the calculation method for a certain level, you can do the following:

Measure = 
IF(NOT HASONEFILTER('Table'[Category1]) && SELECTEDVALUE('Table'[Category2]) = "Gross Profits",10000,SUM('Table'[Amount]))

vjianpengmsft_2-1729752843326.png

If you want to modify calculations at multiple levels at the same time:

vjianpengmsft_3-1729753349035.png

The above and the documentation provided by Super User are the current viable methods. In Power BI, you can't add rows to a matrix at will. This is the same principle as pivot tables in Excel.

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Your solution is so great Greg_Deckler 

Hi, @Mattm1989 

According to your description and the screenshots shown, in addition to using the Super User method to achieve this goal, you can also refer to the following method:

Since the matrix implements a hierarchical structure, you have the following levels:

vjianpengmsft_0-1729752367550.png

If not, you can increase these calculated columns using the IF condition or the switch function. Set in the matrix as follows:

vjianpengmsft_1-1729752556437.png

If you want to change the calculation method for a certain level, you can do the following:

Measure = 
IF(NOT HASONEFILTER('Table'[Category1]) && SELECTEDVALUE('Table'[Category2]) = "Gross Profits",10000,SUM('Table'[Amount]))

vjianpengmsft_2-1729752843326.png

If you want to modify calculations at multiple levels at the same time:

vjianpengmsft_3-1729753349035.png

The above and the documentation provided by Super User are the current viable methods. In Power BI, you can't add rows to a matrix at will. This is the same principle as pivot tables in Excel.

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

Mattm1989
Regular Visitor

Surely there must be another way? This seems fairly complex for a beginner to try and figure out! 😕

Greg_Deckler
Community Champion
Community Champion

@Mattm1989 You generally use a disconnected table for this, similar to this: The New Hotness (Custom Matrix Hierarchy) - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.