Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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)"
 
  • 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
    )
    

     

1 Reply

  • AlB's avatar
    AlB
    Community Champion

    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
    )