Sometimes on a Dashboard, space is at a premium; in these instances, you may feel that there are several different chart types you would like to show but are unable to, or that there should not be a sacrifice on design, purely for the sake of negative space. Sheet swapping is an ideal solution, allowing you to configure buttons and/or selections to change between sheets, without losing detail.
This is a function that can also be modified to work with buttons instead of a visible drop-down parameter, a technique I will explain later on.
Method 1: Parameter Drop Down
As per the example above, I have used Superstore to create two simple sheets: Sales by Region (in the form of a bar chart), and Sales by State (in the form of a Map). This trick relies on three constituent parts: using containers, parameterisation, and a calculated field.
First off, having created your charts, create a parameter. In this parameter, select the data type to be string, the allowable values to list, and input two values - the two I have gone for here are the names I want to display for my two charts. If you wanted more charts, it would simply be a case of doing all of these steps, but with more charts.
Click ok, and then select the parameter and choose to show. Next, we will create the calculated field: this is the easiest part, as this field is simply the parameter in a calculation, allowing us to use it in the filters shelf (the parameter alone would not allow this).
This next part is the slightly fiddly bit. Navigate to whichever sheet/chart is currently selected in your parameter (you will have to show the parameter on both sheets); once you have found that sheet, bring the newly created calculated field onto the filters shelf, and select the value within. Only one value (the value selected in the parameter) should be available. Having done this, then move to the other sheet, change the parameter whilst on that sheet (i.e. so that the sheet and the parameter entry match), and move the calculated field onto the filter shelf again, selecting the visible entry as before.
Now to build the dashboard to demo the function. Create a new dashboard, and bring on a horizontal container. Within this, place both the charts you would like to switch between. Now, scale one of the sheets to be very thin, and show the sheet swapping parameter that we made on the dashboard. Finally, one crucial step here - hide the titles for these sheets. This is essential for the function of the chart swap. Like magic - suddenly, one sheet only is visible! Changing the selection within the parameter will then switch to the other chart, and suddenly the function works.
If you want to add slightly more dynamism to your dashboard, you could also bring in a text box, and use the parameter as part of your text field - as per the GIF at the start of this post, the title will change to correspond with the chart.
Method 2: Parameterised Buttons
There may be instances where you do not want to have the parameter visible, or maybe want visual cues (such as icons) to indicate where to select, based on a particular view. Buttons require slightly more work, but can lead to an additional level of polish and ergonomics. I am following the same instructions found in this YouTube tutorial.
Firstly, I am going to create two calculated fields, named "Bar Chart" and "Map". These fields simply have the title inside of them, contained within speech marks. Then I am going to make two more calculated fields - this time, named "One" and "Zero", with those respective numbers contained within them. The latter two calculated fields should then be converted to discrete dimensions.
Next, open up a new sheet. Here, drag "One", "Zero" and one of your two chart calculations (I have used "Bar Chart") onto details on the marks card. Change this sheet to fit entire view, name it "Button 1", then duplicate it. On the duplicate, swap out one chart calculated field for the other, and name it "Button 2", then head over to your dashboard.
On this new sheet, position your two sheets to swap inside the same container, and then, in a new container, place your two newly formed button sheets. These shapes will form your buttons, so feel free to change the mark type to a shape on either/both sheets and customise their appearances (importing shape files can be a way of giving them some personalisation).
The tricky part comes when creating the actions. Head to the Dashboard tab at the top of Tableau, and select "Actions...". Select "Add Action", and choose "Filter...". We're going to make four of these, and they should look like this:
These are a bit fiddly, so make sure you have your fields/sheets clearly named, your clear selection options configured, and pay special attention to the "Target Filters" at the bottom - some of them relate to themselves, some of them have different source and target fields. Effectively, this combination of filter actions ensures that only data from the correct chart is shown from the corresponding button click, as well as allowing the action to reset every time the other button is clicked.
Whilst I haven't formatted the tooltips, you can clearly see the functionality working, as well as how this can elevate a dashboard by preserving whitespace and enabling a level of interactivity!