Tableau: Use filter action fields to update sheet titles

3 February 2020

In this blog I will go through how I use fields generated from a dashboard filter action to update sheet titles as seen in Fig. 1 below using Sample Superstore data.

Fig. 1: Chart titles update according to what had been filtered.

The dashboard above shows that when I filter for a single state or sub-category (depending which chart), the adjacent chart title will update to say what entry it has been filtered for.
For example, if I filter for Binders in the PROFIT BY SUB-CATEGORY chart, then the SALES BY STATE sheet will update to say SALES BY STATE FOR BINDERS.

Before proceeding with the steps on how to do this, build two charts. One sheet should have Sales by State as seen in Fig. 2, and the other sheet should have Profit by Sub-Category as seen in Fig. 3.

Fig. 2: Sheet with SUM([Sales]) by State.
Fig. 3: Sheet with SUM([Profit]) by Sub-Category.

Steps:

1) Create a calculated field and insert the following.

IF {FIXED : COUNTD([State])} > 1 THEN ''

ELSE ' IN ' + UPPER(STR([State]))

END

The above calculated field will be called Title - show state.

The above calculation essentially says: If the total number of states is greater than 1 then return a blank entry. Or, if its not greater than 1 (so, total number of states is 1) then return ' IN ' and the name of State in upper case.

2) Create another calculated field and insert the following.

IF {FIXED : COUNTD([Sub-Category])}>1 THEN ''

ELSE ' FOR ' + UPPER([Sub-Category])

END

This calculated field will be called Title - show sub-category.

3) Add Title - show state to the sheet with Profit by Sub-Category onto the Tooltip card in the Marks pane. Then add this field onto the title at the end of the text.

4) Add Title - show state calculated field to the sheet with Sales by State onto the Tooltip card in the Marks pane. Then add this field onto the title at the end of the text.

Fig. 4: Place the calculated field onto the Tooltip card in the Marks pane.

5) Add both sheets that were built in Figures 2 and 3 onto a dashboard, and place them next to each other.

6) Set up two dashboard action as seen in both Figures 5 and 6.

Fig. 5: Dashboard filter action to target Profit by Sub-Category sheet.
Fig. 6: Dashboard filter action to target Sales by State sheet.

7) Enable the both of the dashboard actions. Then you'll notice in both sheets that the dashboard filter action field will appear both of the sheets' filter pane. You'll notice that it has two overlapping rings, showing that that filter action field is a set.

Fig. 7: Enabling the dashboard action on the dashboard will generate a field in the sheets' filter pane. The overlapping rings indicate the field is a set.

8) Add both of the fields in each sheet to context.

Fig. 8: Add the dashboard action field to context.

All set! Now, your dashboard should update to show which bar you filter, provided you select one bar.
Why one bar? This is because the calculated fields in steps 1 and 2 are only looking for one [Sub-Category] or [State] in the respective views.

Fig. 9: Dashboard updates the chart titles accordingly when selecting one bar per sheet.

If you would like to view the workbook and see how it was built then you can view it on this link.

Let me know what you think. Feel free to post your thoughts below in the comment section.

Author:
Seffana Mohamed-ajaz
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Information Lab and data industry
Subscribe now
© 2024 The Information Lab