Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to write a DAX function when a Slicer value is selected/included?

I have a Slicer, i.e.   I want to write a logic DAX function using IF() like: If "Successful" is selected, then do A, otherwise do B "Successful" could be selected as a single or one of mu...
  • v-yuta-msft's avatar
    6 years ago

    Anonymous ,

     

    You may create a measure using dax below:

    Result = IF(CONTAINSSTRINGEXACT(CONCATENATEX(ALLSELECTED('Table'), 'Table'[project_status], ""), "Successful") = TRUE(), "A", "B")

     

    Community Support Team _ Jimmy Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • PaulDBrown's avatar
    PaulDBrown
    6 years ago

    Anonymous 

     

    I see v-yuta-msft  has provided a solution (I wasn't even aware of the function CONTAINSSTRINGEXACT!)

     

    Just as an alternative, I worked on a different approach: