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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BishwaR
Helper V
Helper V

Better way of writing Nested IF

I have a dax like

 

status =

          IF ( Number < 10,"Poor",

          IF (Color = "Black", "Good")," No Comment"

I have seen people writing such condition writing IF only once ( I may be wrong)

 

Status = IF ( Number <10,Color = "Black")---- 

 

Is it possible ?

           

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@BishwaR  You can use && for AND and || for OR conditions in filters. I'll be writing a blog on this soon as you're the second person in as many days to have a similar question. 

 

You can either use SWITCH or continue with IF. Here is how you could write using SWITCH (note order matters so anything less than 10 will be poor, even if the color is black):

 

status =

          SWITCH ( TRUE()
, Number < 10,"Poor"

, Color = "Black", "Good",

" No Comment"

)


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

1 REPLY 1
AllisonKennedy
Super User
Super User

@BishwaR  You can use && for AND and || for OR conditions in filters. I'll be writing a blog on this soon as you're the second person in as many days to have a similar question. 

 

You can either use SWITCH or continue with IF. Here is how you could write using SWITCH (note order matters so anything less than 10 will be poor, even if the color is black):

 

status =

          SWITCH ( TRUE()
, Number < 10,"Poor"

, Color = "Black", "Good",

" No Comment"

)


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors