Have you noticed that your Tableau viz in tooltip is not working for grand totals? See how the Grand Total viz in tooltip doesn’t filter?
In the above image, showing the totals per sub-category in the tooltip, notice the amounts? The totals per sub-category are greater than the grand total for the country. Clearly this isn’t possible.
This is because the viz in tooltip doesn’t filter when hovering over the grand total. It’s showing the sub-category totals for all countries, not only the country displayed in the tooltip.
How do I get grand totals to filter when using a viz in tooltip?
Set Actions is the answer.
We can use Set Actions to make the viz in tooltip filter for Grand Totals.
Although a small hack, it is straightforward to set up.
How to use Set Actions to filter the viz in tooltip for Grand Totals
The easiest way to demonstrate this is to create it. This is using one of the Superstore data sources Tableau provides.
Build a simple heatmap showing Sales by Country per Year. Switch on the Grand Totals so you see the total per Country.
Also build a simple bar chart of sales by sub-category. This bar chart will be the viz in tooltip.
Create a new dashboard and drag in the heatmap. Next set up the viz in tooltip. Within the heatmap tooltip, add the Sheet to the tooltip and by default it filters for the relevant Country and Year.
However, hover over the grand total, and it shows the data for every country, not only the country of the row.
This is another great use case for set actions.
Add a Set Action to filter grand totals in the tooltip viz
Create a set on the Country field and select all values.
Call this set action [Set Country]
Drag [Set Country] to the filters shelf of the Tooltip viz, the sub-category bar chart. By default Set filters are boolean, and it will be set to True – i.e. it displays all selected values.
Now the set is created and is ready to work on the tooltip viz.
Back to the dashboard to create the set action.
On the menu bar choose Dashboard – Actions. Add Action and Change Set Values.
Set up the action to run from the Heatmap sheet and run on Hover. The data source is the Superstore data source and it will Assign values to set. The set to affect is the [Set Country] and Clearing the selection will Add all values to set (which is as it is now with all countries selected).
Now hover over the Grand Total and see the result.
The viz in tooltip now filters in the Grand Totals!
Download the workbook showing how to filter grand totals in a tooltip viz from Tableau Public.
See it in action below in the embedded workbook.