Forum Discussion
How to write a DAX function when a Slicer value is selected/included?
- 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.
- 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:
Anonymous
you can use SELECTEDVALUE in your measure. For example:
measure = IF(SELECTEDVALUE(table[project_status]) = “Successful”, [measure 1], [measure 2])- Anonymous6 years agoNot applicable
Thank you.
But it only works for a single selection. If I select multiple values including "Successful", it can't work...
- PaulDBrown6 years agoCommunity Champion
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:
- Anonymous6 years agoNot applicable
Thanks.
In my case, need to change the last line into: if(calc>=1,"YES","NO")