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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mamoormasoomi
Helper I
Helper I

Nested IF with multiple Columns in a Logical Test

HI,

 

I am trying to implement the nested IF with AND operator in DAX. Please see the below condition and help me. 

 

Actually, I am trying to check two compound conditions in one row. The blue colored texts checking and returning the value of the corresponding cell from column (AE) into column "Lift UT" If all the conditions are true and if not true then pointer going to the next condition and checking the red colored texts. if all the red colored conditions are true then returning the value of the corresponding cell from column ( AE) into the column "Lift UT". if both (Blue and Red Colored conditions are not true then 'Lift UT" column getting Blank Space.

 

Please check the below excel column conditions and table.

 

=IF(AND(AX3="Y",A3="CYLV",AW3=1, AQ3="Debit"),AE3,IF(AND(AX3="N",A3="CYLV",AW3=1),AE3,""))

 

AAEAQAWAXLift UT
CYLV3Debit1Y3
CYLV1Credit1Y 
CYLV1Debit1N1
CFLB5Debit1Y 
CFLB2Debit2Y 
CYLV1Debit3N 
CYLV3Debit1Y3
CFLB2Debit1Y 
CYLV1Debit1N1

 

 

1 ACCEPTED SOLUTION

Hey,

 

unfortunately you did not use the "Insert Code" function to paste your DAX statement.

 

The Problem is raised by the 2nd switch, please be aware that AND(..., ...) just accepts 2 conditions for this reason you statement has to look like this

SWITCH(TRUE()
AND(AND(C1, C2), AND(C3, C4)), this,
AND(AND(C1, C2), C3), that
)

Hopefully this resolves your issue.

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

4 REPLIES 4
TomMartens
Super User
Super User

Hey,

 

using DAX you have to combine multiple AND, this due to the fact that AND just takes 2 conditions, like so

IF(
AND(
  AND(condtion1, condition2)
  ,AND(condtion3 condition4)
)
,what should happen if the above is true
,...

Hopefully this is what you are looking for.

 

Regards

Tom 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi Tom,

 

Thanks for your help but I am still having the issue please check the below syntax error and advise.

 

Power BI5.jpg 

Anyone can help me, please.

 

Thanks.

Hey,

 

unfortunately you did not use the "Insert Code" function to paste your DAX statement.

 

The Problem is raised by the 2nd switch, please be aware that AND(..., ...) just accepts 2 conditions for this reason you statement has to look like this

SWITCH(TRUE()
AND(AND(C1, C2), AND(C3, C4)), this,
AND(AND(C1, C2), C3), that
)

Hopefully this resolves your issue.

 

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.