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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Robin96
Helper II
Helper II

Nested IF or ?

Hey, i am running into a problem when i need to make a conditional formatting setting, but i have 15 measures for each row in a table. I have tried the measure below, but it only works for the measure called "Serviceavtaler", i also want the exact same for Subsription, but it only allows me to do 2 ifs in the return. Anyone have any idea?

Robin96_0-1674738237484.png

 

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Robin96 Try using a SWITCH(TRUE(),...) statement instead of nested IF statements.

SWITCH(TRUE(),
  serviceavtaler <= 1, "#FF0000",
  servicevtaler > 0, "#008000",
  <next condition>, <next value>,
  ...,
  <default value>
)


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hey @Greg_Deckler 

I tried your solution, but it looks like the first condition is met in the first row, so it applies that expression to the whole table. i am trying something like this without any luck:

Robin96_0-1674739134557.png

i want it to change color based on the value in the row level. Here is a picture of the measure for the table Is there any way to color format in here??:

Robin96_1-1674739192915.png

 



@Robin96 Right, the first condition that is met is what is returned. Note, that would be similar to nested IF statemetns. So, you will need additional conditions perhaps using && or something else to distinguish what things get what colors. Hard to say more as I don't know all the business rules.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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