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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

In what order are nested conditions evaluated?

Hello

 

First, I would like to say that the DAX limit of AND/OR functions to accept only two conditions, while Excel accepts unlimited conditions, is extremely inconvenient. Is there a fix for this? Nesting conditions makes the whole expression very complex.

 

Secondly, in what order are nested conditions evaluated? I had the impression that they are evaluated from left to right, e.g.:

 

IF(condition1,IF(condition2,do1,do2)) = I thought that condition1 is evaluated first and then condition2.

 

Is this the case? Because I read 'If a DAX calculation is nested, theinnermost function is evaluated first.' which is very confusing.

 

Thanks!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous first thing first, for multiple AND and OR , you can use && for AND and || for OR

 

IF (  x = 1 && y = 2 &&  z = 3 && p = "x", "abc", "xyz" )

 

 

IF (  x = 1 || y = 2 || z = 3 || p = "x", "abc", "xyz" )

 

on 2nd question, left to right, condition1 and then condition 2

 

Would appreciate Kudos 🙂 if my solution helped.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

For the first question, you can use "&&" / "||" instead.

AND(AND(AND(OR(OR(OR(1=1,2=2),3=3),4=4),5=5),6=6),7=7)
(1=1||2=2||3=3||4=4)&&5=5&&6=6&&7=7

For the second question, logic of IF() function is from left to right and logic of AND() / OR() function is from inside to outside.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

First The first if the condition will be evaluated, 

TRUE - Condition is true will process

False - Condition is true will process

 

https://docs.microsoft.com/en-us/dax/if-function-dax

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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
Stachu
Community Champion
Community Champion

Regarding your first question - you can use multiple conditions with && for AND and || for OR, e.g.

(true && true && false)

  returns false

(false || true || false)

returns true 

 

to my knowledge your intuition regarding the order of conditions evaluations is correct

the statement about the inner calculation being evalauted first is also true, but it refers to the filter context, which is very different from conditions, see more detailed explanation here:

https://www.sqlbi.com/articles/order-of-evaluation-in-calculate-parameters/



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

parry2k
Super User
Super User

@Anonymous first thing first, for multiple AND and OR , you can use && for AND and || for OR

 

IF (  x = 1 && y = 2 &&  z = 3 && p = "x", "abc", "xyz" )

 

 

IF (  x = 1 || y = 2 || z = 3 || p = "x", "abc", "xyz" )

 

on 2nd question, left to right, condition1 and then condition 2

 

Would appreciate Kudos 🙂 if my solution helped.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.