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 August 31st. Request your voucher.

Reply
evabgc
Frequent Visitor

Calculate (sub) totals in switch statement

Hi all,

 

I have created a financial statement in Power BI based on this method: 

https://www.youtube.com/watch?v=J4317R5BvsA


I have thus created many CALCULATE measures and have used the SWITCH measure to insert these in the required order.

However, I would really like to have the subtotals and gran total calculated "inside" this table, and not calculating it separately and inserting it with SWITCH, primarily to make sure there are no mistakes in the many measures that have been created manually.

In excel, the totals are shown with a simple SUM formula. Is it possible to do something in DAX?

 

Screenshots for reference:

Part of my financial statement/table below. Yellow is where I would like the subtotal, red is what should be included in this subtotal.

evabgc_0-1682566535376.png

Snippet of my SWITCH measure:

evabgc_1-1682566614057.png


Thanks in advance!

 

1 REPLY 1
lbendlin
Super User
Super User

 provide a parent hierarchy according to the groupings you want, and then use HASONEVALUE and ISINSCOPE to figure out where in the hierarchy you are.

 

Note:  Including subtotals without clear visual separation is a UX red flag.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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