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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Thorstedt
Regular Visitor

Is it possible to have an If function in another If function

Hi 

I'm interested in moving this DAX formular into Power Query: 

S1 = IF(IF('STATUS 1'[t2s1q4] >2;1;0)+If('STATUS 1'[t2s1q5] >2;1;0)+If('STATUS 1'[t2s1q11] >2;1;0)+If('STATUS 1'[t2s1q12] >2;1;0)+if('STATUS 1'[t2s1q13] >2;1;0)+if('STATUS 1'[t2s1q14] >2;1;0)+if('STATUS 1'[t2s1q15] >2;1;0) >2;TRUE;FALSE)

It is an If function with multiple If functions within it: If(if + if + if ..) then, else - I am using it to measure If different test scores are above a certain limit (>2) and finally If >2 of these tests are above that limit. All the STATUS tables range from 1-5.

Is this possible in Power Query, as it is in DAX?

I'm fairly new to M, so this might be a newbie question. I would appreciate any help!


1 ACCEPTED SOLUTION

Please note, you can also use "and" "or".  An example of a simple one:-

 

If 

  ( 

    [Column1] = "A"

  and

   [Column2] = "B"

 )

then "Confirmed A & B"

 

else if

  "not A&B"

else

  "something else"

View solution in original post

4 REPLIES 4
Nolock
Resident Rockstar
Resident Rockstar

Hi @Thorstedt,

jop, it is possible. Just add a new column in PowerQuery Editor UI and rewrite your many ifs. A documentation for IF can be found here: https://docs.microsoft.com/en-us/powerquery-m/expressions-values-and-let-expression#If

 

Hi @Nolock  

Thanks, I figured out the different formulation: If((if [a] >x THEN y ELSE z)+(If [b] >x THEN y ELSE z) .... ) >x THEN "True" ELSE "False") 

Udklip.JPG
Thanks!

Please note, you can also use "and" "or".  An example of a simple one:-

 

If 

  ( 

    [Column1] = "A"

  and

   [Column2] = "B"

 )

then "Confirmed A & B"

 

else if

  "not A&B"

else

  "something else"

That might be a simpler solution than my first attempt. Thanks! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors