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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
ray_ux
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
ray_ux
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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors