Forum Discussion

StoryofData's avatar
StoryofData
Helper III
3 years ago
Solved

DAX with Multiple Conditions

How do I write out a measure that would concatenate two columns based on the following conditions:

If Employee ID is blank then result should always be blank 

If Employee ID is filled in but City OR State Contains Not Applicable OR Not Disclosed then also blank

If all columns are filled in, concatenate Case # & Employee ID

 

 

 

  • Hey StoryofData !


    Try the DAX bellow, and if it helps, please mark as solved. Thanks!

     

    new_column =
    SWITCH (
    TRUE (),
    [Employee_ID] = BLANK (), BLANK (),
    [Employee_ID] <> BLANK ()
    && CONTAINS ( YOUR_TABLE, [CITY], "NOT APPLICABLE", [STATE], "NOT APPLICABLE" )
    = TRUE ()
    || CONTAINS ( YOUR_TABLE, [CITY], "NOT DISCLOSED", [STATE], "NOT DISCLOSE" )
    = TRUE (), BLANK (),
    COMBINEVALUES ( "-", [CASE], [EMPLOYEE ID] )
    )

2 Replies

  • Hey StoryofData !


    Try the DAX bellow, and if it helps, please mark as solved. Thanks!

     

    new_column =
    SWITCH (
    TRUE (),
    [Employee_ID] = BLANK (), BLANK (),
    [Employee_ID] <> BLANK ()
    && CONTAINS ( YOUR_TABLE, [CITY], "NOT APPLICABLE", [STATE], "NOT APPLICABLE" )
    = TRUE ()
    || CONTAINS ( YOUR_TABLE, [CITY], "NOT DISCLOSED", [STATE], "NOT DISCLOSE" )
    = TRUE (), BLANK (),
    COMBINEVALUES ( "-", [CASE], [EMPLOYEE ID] )
    )

  • Thank you so so much! I went down few different avenues but did not try swith