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
Anonymous
Not applicable

how to switch values in matrix with multiple degree rows

Hi, here is my sample looks like:

version  south south1 south2 north north1 north2
A201920181110
B131917151712
C131520131617
D201810151419

and I need to visual it in matrix like this, the row level should remain indentation in matrix,

  ABCD
south 11141613
 south1 16181720
 south210201318
north  13141620
 north1 11181219
 north213111416

I created a dimension table:

dim_h1 dim_h2
south  south1
south south2
northnorth1
northnorth2

and write the measure:

Measure =
SWITCH(TRUE(),
SELECTEDVALUE('dimension'[dim_h1])="south",CALCULATE(SUM('table'[south])),
SELECTEDVALUE('dimension'[dim_h1])="north",CALCULATE(SUM('table'[north])),
SELECTEDVALUE('dimension'[dim_h2])="south1",CALCULATE(SUM('table'[south1])),
SELECTEDVALUE('dimension'[dim_h2])="south2",CALCULATE(SUM('table'[south2])),
SELECTEDVALUE('dimension'[dim_h2])="north1",CALCULATE(SUM('table'[north1])),
SELECTEDVALUE('dimension'[dim_h2])="north2",CALCULATE(SUM('table'[north2]))
)
but the result is like this, it seems level 2 dimension did not return the correct vlaue, and  I need to keep a identation in row level. can you help to correct the DAX?
olive100101_0-1683523362075.png

 

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , better to unpivot the data of the source table, and unpivot columns other than the version

 

https://radacad.com/pivot-and-unpivot-with-power-bi
Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

Power Query Table.Unpivot, Table.UnpivotOtherColumns: https://youtu.be/0FEGEAz9UMw

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.