Forum Discussion

AliH's avatar
AliH
Frequent Visitor
8 years ago
Solved

Obtuse SQL Case statement to DAX

Hi All,   First post here - DAX is defeating me on this one. I know the basic SWITCH(), but I have a more complicated 'Switch' I'm trying to get working in DAX and hoping some guru here can help. ...
  • Anonymous's avatar
    Anonymous
    8 years ago

    AliH

     

    Gotcha, that makes sense. I bet you could do this with a single SWITCH though. Something like:

     

    CaseStatement =
    SWITCH(
       TRUE(),
       AND(Status="T", OR(ShippingDate <= TODAY(), complete = 0)), "Trapping",
       AND(Status="T", OR(ShippingDate > TODAY(), complete <> 0)), "FutureTrapping"
    )

    With AND's and OR's, you can specify the same logic as your SQL. If all of these columns are in different tables, make sure to use RELATED if they have a valid relationship.

     

    Hope this helps,

    Parker