Showing nothing in Tableau when "All" selected

Another great question from a Tableau user appeared a few weeks back. I run Tableau doctor sessions by webex every week and this particular question I think has a lot of uses.

The scenario was this:

The user wanted to have images (using custom shapes) display on a dashboard when an end user selected an item in a filter, but when they selected "All", then all the images appeared. Instead they didn't want anything to show up (display blank). We couldn't hide the "All" value from the filter, because it was also being used elsewhere on the dashboard where they did want to select all.

Here's the solution:

Create a calculated field that counts the number of rows in the view. Then test if this value is greater than 1. To do this I'm using the INDEX() function (which will find out the row number) and then doing a window_sum() of that to get the total number of rows in the view.

This creates a boolean (true/false) calculation. We then place this on the filter shelf. We want to include the false or exclude the true.

And that's it! There are lots of uses for this I'm sure.



Post a comment

to top