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
Maximous89
Regular Visitor

DAX Switch & nested IF

https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-challenge-nested-if-or-switch-is...

 

i can't belive there is no solution for this,

 i need a simple dax measure 

IF( ISINSCOPE( HIER[LEVEL_7_DESC] ), 17, IF( ISINSCOPE( HIER[LEVEL_6_DESC] ), 16, IF( ISINSCOPE( HIER[LEVEL_5_DESC] ), 15 ) ) )

 

this doesn't work because if i change the order of column in the visual then the higher or the first condtition will always be the only one is true returning this value only?!!

 

 

 

7 REPLIES 7
v-hashadapu
Community Support
Community Support

Hi @Maximous89 , Hope you're doing okay! May we know if it worked for you, or are you still experiencing difficulties? Let us know — your feedback can really help others in the same situation.

v-hashadapu
Community Support
Community Support

Hi @Maximous89 , hope you are doing great. May we know if your issue is solved or if you are still experiencing difficulties. Please share the details as it will help the community, especially others with similar issues.

v-hashadapu
Community Support
Community Support

Hi @Maximous89 , Hope you're doing fine. Can you confirm if the problem is solved or still persists? Sharing your details will help others in the community.

v-hashadapu
Community Support
Community Support

Hi @Maximous89 , Thank you for reaching out to the Microsoft Community Forum.

 

As you haven't shared any data and it is very hard to provide a solution without it, I took some sample data based on your scenario and created a .pbix file with a working solution for you reference. Please check the attached .pbix file and share your thoughts.

 

Thank you.

Rupak_bi
Super User
Super User

hi @Maximous89 ,

Please share some sample data and expected output to understand the ask. sometimes only looking at the DAX doesn't help but the entire scenario does.



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/
wardy912
Solution Sage
Solution Sage

Hi @Maximous89 

 

You could use a measure that checks which level has a non-blank value, assuming each level is only populated when it's relevant:

LevelNumber = 
SWITCH(
    TRUE(),
    NOT(ISBLANK(SELECTEDVALUE(HIER[LEVEL_7_DESC]))), 17,
    NOT(ISBLANK(SELECTEDVALUE(HIER[LEVEL_6_DESC]))), 16,
    NOT(ISBLANK(SELECTEDVALUE(HIER[LEVEL_5_DESC]))), 15,
    BLANK()
)

 

I hope this helps

MasonMA
Memorable Member
Memorable Member

@Maximous89 

 

Weird when you say 'i can't belive there is no support on this'.. I clicked open your original post and saw Community support followed up twice on your question there. 

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.