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
dedelman_clng
Community Champion
7 years agoTry HASONEVALUE
IF ( HASONEVALUE ([County]), [County], "Multiple Counties" )
Hope this helps
David
- Anonymous7 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_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!
- 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.