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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
adamgn
New Member

syntax for multiple nested ifs

hi all, im looking for the syntax for multiple nested ifs but dont find any real help. what would the syntax be for something like =IF ([answer] = "yes" AND ([Homework] = "Math" OR [Teacher] = "Absent"))
 
i would like to nest and OR statement after an AND statement within the same IF statement. in otherwords, if the content in column [answer] = yes AND either [homework] = "math" or [teacher] = "absent" return "help"
1 ACCEPTED SOLUTION
RayWu
Memorable Member
Memorable Member

@adamgn 
https://docs.microsoft.com/en-us/powerquery-m/operators

 

Operator    Description
or    Conditional logical OR
and    Conditional logical AND
not    Logical NOT

 

just use brackets to force the precedence as required
https://docs.microsoft.com/en-us/powerquery-m/m-spec-conditionals

 

if 2 > 1 then 2 else 1          // 2
if 1 = 1 then "yes" else "no"   // "yes"​




 

View solution in original post

1 REPLY 1
RayWu
Memorable Member
Memorable Member

@adamgn 
https://docs.microsoft.com/en-us/powerquery-m/operators

 

Operator    Description
or    Conditional logical OR
and    Conditional logical AND
not    Logical NOT

 

just use brackets to force the precedence as required
https://docs.microsoft.com/en-us/powerquery-m/m-spec-conditionals

 

if 2 > 1 then 2 else 1          // 2
if 1 = 1 then "yes" else "no"   // "yes"​




 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.