We can explore and analyze data in a dynamic and interactive way with the help of tools in Tableau. One of the key elements of a successful Tableau dashboard is the user’s ability to interact easily and intuitively with the data. In this blog post, we’ll analyze the toggle Switch concept and demonstrate how to incorporate it into your Tableau dashboard to increase user engagement. Using a toggle switch we can switch between different data displays or statuses with only one click, creating a seamless and engaging experience.

Benefits of Toggle Switches:

When added to a Tableau dashboard, toggle switches provide the following advantages:

  • Simplified Data Exploration: Toggle Switches make it simpler to look at and compare data by allowing to flip between different views without clogging the dashboard with too many views.
  • Enhanced User Engagement: Toggle switches helps to create a dashboard that is more engaging and dynamic by adding interactive components, encouraging users to interact with the data.
  • Improved User Experience: Users may find it as easy and effective way of engaging with the dashboard by using toggle switches, which allow them to control viewing options for exploring and comparing data.
  • Space Optimization: To present several data views in an orderly manner and to consolidate and compact manner rather than using up valuable dashboard space with numerous sheets or filters.

There are different ways where you can add a toggle button such as using parameter actions and table calculations. In this article, will guide you to create a toggle switch using a few simple steps without using parameter actions.

Steps to Add a Toggle Switch in Tableau:

Here, we are going to create a toggle button to switch between ‘Fatal Road Accidents per State’ and ‘Fatal Road Accidents per 10,000 people’. I have already created two separate Tableau sheets for ‘Fatal Road Accidents per State’ (Red Map) and ‘Fatal Road Accidents per 10,000 people’ (Blue Map).

Step 1:

First, create a new dashboard and then let’s drag the ‘Fatal Road Accidents per State’ to a horizontal container.
Then, we can drag ‘Fatal Road Accidents per 10,000 people’ to the same horizontal container.
After hiding the titles, you could see a view like below.

Step 2:

In the dashboard, let’s say we want to view the red map which is ‘Fatal Road Accidents per State’ as default and when we click on the switch button, we want to view the ‘Fatal Road Accidents per 10,000 people’, which is the blue map.
Therefore, now we have to set our blue map to ‘Floating’. In order to do that, click on the ‘more options’ (Down Arrow) using the tool window of the red map and select ‘Floating’.

Now, we will get a view as below.

Next, we are required to overlap these two maps, then only it helps to switch.

Step 3:

In order to sync and lay the red map over the blue map, let’s first get the dimensions of the blue map. Go to the lay out map and get the position (x and y) coordinate and Size coordinates (w and h) of the blue map.

Next, we will change the coordinates for red map. Position and size coordinates should be same for both the maps. Then we can see the red map over the blue map.

Step 4:

Now if we go to the ‘more options’ (Down Arrow) using the tool window in the red map, we can see the option “Add Show/Hide Button”. Once we click it, we will get something like below.

After adding show/hide button, we can see the button like this.

And, once again, when you click on the options we can see how it works by clicking on Show or Hide option. Alternatively, we can use Alt + Click as well.

Step 5:

Now, we just make it to look nice in the dashboard. In order to add a nice toggle switch you can just download toggle switches : ON and OFF. For that, simply we can click ‘Edit Button’ as below and a window will appear with the edit options for the button.

We can download two images for ON and OFF.

When the item is shown, we can display ‘OFF’ – Gray Button and if hidden, ‘ON’- Blue Button.

This will add the ON- Blue Button to the dashboard. Next, will add the OFF image.

Then, you can see a gray button on your dashboard.

To view the function, let’s go to presentation mode.

Let’s click the button.

It will change the view to ‘Blue Map’, and you will see the Blue Button.

BOOM! Here we go, now we can switch between two maps.


The Data School
Author: The Data School