Tableau’s default behaviour is that when you click a data point, it stays selected. This is intuitive behaviour and makes total sense when a click has driven a filter on a dashboard.
However, given the size and creativity of the Tableau community, clicking a data point has been used in countless other ways. Sometimes, you simply don’t want it to remain selected, i.e. when using a sheet to clear the filters on a dashboard. There have been workarounds for this from the simple “Please double-click” to the brilliant, never-ending pages of Josh Milligan.
New features are constantly included into the Tableau suite—one of the reasons we all love the tool—and a recent (v2019.2) powerful change is the ability to update a parameter using an action. Previously, parameters were static user-driven pieces of information; incredibly powerful but static. Now, they have been given a new lease on life with the addition of parameter actions.
The Power of Parameter Actions
If you haven’t played with them, I’d highly recommend it. Why not try this simple technique to deselect a button as a starter?
Here’s an example of it in action. I’ve left in the default behaviour, so you can see the difference:
This technique works on the principle that a data point only stays selected if it still exists. If the data point disappears, or (in this case) is replaced by another, it loses its selected status. Here, we build a field which toggles odd to even on each click:
1. Create a parameter called Counter with type integer:
2. Create a calculated field to check whether the counter is odd or even:
Okay, strictly speaking, this doesn’t exactly check to see if it is odd or even. Using modulus %2 does, however, return a 0 when the number is even and 1 when it is odd.
3. Create a calculated field called Counter +1:
4. Add the Counter Even/Odd calculation onto Rows (discrete and to the left), and hide the header if desired. Next, add Counter +1 onto Detail as an average:
Note: You can use the odd/even as a ATTR() if you don’t want it to mess up any table calculations, etc.
6. Create your dashboard parameter action to +1 to the parameter value when clicked:
Now, click away on your dashboard…
There are five steps here, but most of these are simple, and you can copy and paste from one workbook to another. Plus, you can use them on many different sheets within a workbook. Let’s face it: the calcs aren’t too complicated either!
Here’s the above example implemented into a fuller featured dashboard: