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
Anonymous
Not applicable

Nested If Statement with ANDs DAX

I used this forum answer to create my dax formula (oops). I don't want a power query, I want it in DAX.

 

Can I do nested if statements in DAX? Or should I use a switch?
Suggestions/solutions very welcome!

 

Let me know if you have any questions.

 
Current State = 
if 'TABLE'[Column1.At least one Build Pending] = "Pending" and 'TABLE'[Column1.At least one Order Pending] = "Complete" 
then "BUILD" 
else if 'TABLE'[Column1.At least one Build Pending] = "Pending", 'TABLE'[Column1.At least one Order Pending] = "Pending" 
then "BUILD/ Service Delivery"
else if 'TABLE'[Column1.At least one Build Pending] = "Complete", 'TABLE'[Column1.At least one Order Pending] = "Pending"), "Service Delivery"
then "Service Delivery"
else NOT ISBLANK('TABLE'[Column1.Current Activity/ Stage Owner(s)])
then "Service Delivery (RID POSTED)"
 
1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @Anonymous 

You can probably use the SWITCH (TRUE() ....

I've only included the first condition cause it's the only one I understand from your code but you get the idea. Check this out for more details. 

Current State =
SWITCH (
    TRUE (),
    'TABLE'[Column1.At least one Build Pending] = "Pending" && 'TABLE'[Column1.At least one Order Pending] = "Complete", "BUILD",
     Condition 2, Result2,
     Condition 3, Result3
)

 

View solution in original post

1 REPLY 1
AlB
Super User
Super User

Hi @Anonymous 

You can probably use the SWITCH (TRUE() ....

I've only included the first condition cause it's the only one I understand from your code but you get the idea. Check this out for more details. 

Current State =
SWITCH (
    TRUE (),
    'TABLE'[Column1.At least one Build Pending] = "Pending" && 'TABLE'[Column1.At least one Order Pending] = "Complete", "BUILD",
     Condition 2, Result2,
     Condition 3, Result3
)

 

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.