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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
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.

Top Solution Authors
Top Kudoed Authors