Forum Discussion
Anonymous
7 years agoNot applicable
How to make a card return predetermined text when no/multiple items in a category selected (example)
https://www.timesunion.com/local/article/More-Capital-Region-students-are-qualifying-for-12497790.php You can see the example a bit down the page under "Free Lunches..." When no counties are ...
- 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
Anonymous
7 years agoNot applicable
Thanks a lot, really helped out! I've almost got it, here's the full code I have right now.
Income Show Text = IF(ISFILTERED(MedianHouseIncome[Geography]),"", "Select County") & IF(HASONEFILTER(MedianHouseIncome[Geography]),FILTERS(MedianHouseIncome[Geography]),"") & IF (HASONEVALUE (MedianHouseIncome[Geography]), "" , "Multiple Counties" )
It works when either one county is selected or when multiple are selected (returning county name and "Multiple Counties" respectively. However, when none are selected, it says "Select CountyMultiple Counties". Any ideas for getting around that?
dedelman_clng
Community Champion
7 years agoTry 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