Forum Discussion
How to generate text based on selected values from a slicer.
- 11 months ago
Hi barragan82 ,
The issue with your measure is that CONCATENATEX on the column returns all values (not just the slicer selection) and the text comparison is very order-sensitive. If you click the slicer in a different order, the concatenated string doesn’t match your C/A/G, C/A/G/I test.
The other way is to check directly whether those values are selected, regardless of order:
Group Project Text =
VAR sel = VALUES('Master Core AY24-25'[WC])
VAR hasCAG = "C/A/G" IN sel
VAR hasCAGI = "C/A/G/I" IN sel
RETURN
IF( hasCAG && hasCAGI, "Group Project", "Blank" )
This returns "Group Project" if both C/A/G and C/A/G/I are selected in the slicer, otherwise "Blank".
It won’t matter in which order the user selects them.Thank you.
- 10 months ago
Hi v-venuppu ,
I aplogize for not replying sooner, I have not been in the forum for a while. I was able to find a separate solution with the following DAX formula. Thank you for checking in!
Group Test 3 = IF(CALCULATE(COUNTROWS(FILTER('Master Core AY24-25','Master Core AY24-25'[WC]IN{"C/A/G/","C/A/G/I"})))>0,"Group Project")
Hi barragan82 ,
The issue with your measure is that CONCATENATEX on the column returns all values (not just the slicer selection) and the text comparison is very order-sensitive. If you click the slicer in a different order, the concatenated string doesn’t match your C/A/G, C/A/G/I test.
The other way is to check directly whether those values are selected, regardless of order:
Group Project Text =
VAR sel = VALUES('Master Core AY24-25'[WC])
VAR hasCAG = "C/A/G" IN sel
VAR hasCAGI = "C/A/G/I" IN sel
RETURN
IF( hasCAG && hasCAGI, "Group Project", "Blank" )
This returns "Group Project" if both C/A/G and C/A/G/I are selected in the slicer, otherwise "Blank".
It won’t matter in which order the user selects them.
Thank you.