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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! 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
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
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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