Forum Discussion
How to make a card return predetermined text when no/multiple items in a category selected (example)
- 7 years ago
Try this code:
Income Show Text = IF ( NOT ( ISFILTERED ( MedianHouseIncome[Geography] ) ), //No filters "Select County", IF ( COUNTROWS ( FILTERS ( MedianHouseIncome[Geography] ) ) > 1, //More than one value "Multiple Counties", SELECTEDVALUE ( MedianHouseIncome[Geography] ) //else condition, implies 1 ) )Hope this helps
David
Try HASONEVALUE
IF ( HASONEVALUE ([County]), [County], "Multiple Counties" )
Hope this helps
David
Thanks a lot, really helped out! I've almost got it, here's the full code I have right now.
- dedelman_clng7 years ago
Community Champion
Try this code:
Income Show Text = IF ( NOT ( ISFILTERED ( MedianHouseIncome[Geography] ) ), //No filters "Select County", IF ( COUNTROWS ( FILTERS ( MedianHouseIncome[Geography] ) ) > 1, //More than one value "Multiple Counties", SELECTEDVALUE ( MedianHouseIncome[Geography] ) //else condition, implies 1 ) )Hope this helps
David
- Anonymous7 years agoNot applicable
That worked! David, you are a rock star!
- dedelman_clng7 years ago
Community Champion
One further thing to realize is that if there is any other filter anywhere in the report or page (not just on the visual or on a specific slicer) then ISFILTERED is going to return TRUE
- Anonymous7 years agoNot applicable
Okay so after thinking about it more, I see what's happening. The & is a concatenation, so it's putting the Select County and Multiple Counties together because they're both false. When multiple counties are selected it shows up correctly because only one is false.
As a work around I could separate them out into two measures and overlay the cards, but I would really like to avoid that if possible and keep it in one measure.