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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors