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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HamzaAhmad
New Member

Putting more than one condition in IF statement

Hello,

I have this table which is displaying the material count "Balance" and green and red indicators indicate if the material balance is 0 (via a red circular indicator) or more than 0 (via a green circular indicator). I want to include an amber indicator too if the material balance gets to 5. Is this possible in Power BI?

 

Also, when any of the indicators are orange or red, the top indicator should become red or orange. If all is green, it should remain green. Please help me and I greatly appreciate your help.

 

question SS2.png

 

Thanks.

1 ACCEPTED SOLUTION

I think I am really close. I can get the green and red indicator but it is not turning amber if the materials become less than 5 but greater than 0, instead it turns green.

 

This is my formula:

 

Close = IF(CONTAINS(Material,Material[Balance],0),"https://image.ibb.co/mVYPcm/rsz_1redindicator.png",IF(CONTAINS(Material,Material[Balance],5,Material[Balance],4,Material[Balance],3,Material[Balance],2,Material[Balance],1),"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png","https://image.ibb.co/kLLRq6/rsz_greenindicator.png"))

Please advise what am I missing here.

 

I solved the first problem by using SWITCH. Formula below:

 

Indicator = SWITCH([Balance],0,"https://image.ibb.co/mVYPcm/rsz_1redindicator.png",5,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",4,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",3,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",2,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",1,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png","https://image.ibb.co/kLLRq6/rsz_greenindicator.png")

View solution in original post

2 REPLIES 2
HamzaAhmad
New Member

Solved the second problem by this formula

 

Column = IF(CONTAINS(Material,Material[Balance],0),"https://image.ibb.co/mVYPcm/rsz_1redindicator.png","https://image.ibb.co/kLLRq6/rsz_greenindicator.png")

 

However, the first problem remains, how to put more than one condition in the IF statement. Something like ELSE IF in PHP.

 

Thanks for your help

I think I am really close. I can get the green and red indicator but it is not turning amber if the materials become less than 5 but greater than 0, instead it turns green.

 

This is my formula:

 

Close = IF(CONTAINS(Material,Material[Balance],0),"https://image.ibb.co/mVYPcm/rsz_1redindicator.png",IF(CONTAINS(Material,Material[Balance],5,Material[Balance],4,Material[Balance],3,Material[Balance],2,Material[Balance],1),"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png","https://image.ibb.co/kLLRq6/rsz_greenindicator.png"))

Please advise what am I missing here.

 

I solved the first problem by using SWITCH. Formula below:

 

Indicator = SWITCH([Balance],0,"https://image.ibb.co/mVYPcm/rsz_1redindicator.png",5,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",4,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",3,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",2,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png",1,"https://image.ibb.co/c0LRq6/rsz_orangeindicator.png","https://image.ibb.co/kLLRq6/rsz_greenindicator.png")

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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