Buttons that deselect themselves
This is tip 19 of my Tableau Speed Tipping session. Refer to the Table of Contents to find the other tips.
-
Use Highlight Action to deselect
Dashboard actions are a genius way of infusing your analyses with interactivity. Hover actions, however, are often confusing for the end user, because they move their mouse without expecting anything to happen, and suddenly the data is being filtered, or the colours change, or they find themselves on another website. Thus, hover actions are rarely ideal, and in many cases we are better off using select actions instead.
The thing with a selection, however, is that Tableau will highlight the selected mark. “Highlight” means that all non-selected marks will be greyed out, leaving only the selected mark in full colour. This can be helpful, but again, users are easily confused, and having to click in order to deselect before clicking something else may be irritating. (It’s definitely irritating me, to be honest.)
Luckily for us, Brian Moore showed a fantastic trick at the Tableau Tip Battle at TC19 in Vegas that deals with this problem. We simply need to use our chosen select action – whether it be filter, set, website, or any other action – together with a highlight action that also activates upon selection.
Let’s try this
“Wait, but isn’t Tableau’s highlight feature the culprit that got us into this mess in the first place?” Indeed it is – and it will get us out again. We simply need to create a calculated field that has the same content in every row of the data. For my use case, I called the field “Deselect”, and the calculation simply reads “asdf”. I then drag this field to Detail in the source sheet for my other action.
Back on the dashboard, I create a highlight action. Upon selection on my source sheet, I target the same sheet again, but only using the field “Deselect”. What happens now?
As our “Deselect” field has the same content in every row of the data, every mark in our source sheet will be highlighted. Remember, highlighting in Tableau means that every non-highlighted mark will be greyed out. As a logical consequence, highlighting everything means that nothing will be greyed out, and everything simply appears unchanged.