MIP Logo

Two ways to implement the chart type switch button in Tableau (Part2)

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here

 

The second method to create the chart switch button is to use parameters. This method will enable the user to switch between more than two charts.

I will use the following three charts to demonstrate how to create the chart switch function by using parameters.

The first chart is a map that shows the geological distribution of all the stations and highlights the top six popular stations in green.

 

The second chart is a bar chart that shows the top six station names and their corresponding number of visitors.

 

The third chart is a combined chart that shows the change in the number of trips in different pass holder types (subscription method).

 

Step1: Create a parameter called “ChartSwitch” and configure it as shown in the following picture.

 

Step2: Create the calculated fields which will work as a filter in the three charts.

Note: In the previous version of Tableau Desktop, you can create a calculated field by simply dragging the parameter into the calculated field editing page. Because if you put this calculated field into the filter shelf, its value would not change as the parameter value changes. In other words, the filter would always relate to the fixed value of the parameter when the filter is created. While when I test this method, it does not work in the recent Tableau Desktop version (2022.2.0). In the recent version, the filter built on the calculation field and the parameter work as follows.

 

Therefore, this single calculation method cannot help us filter the right chart type in the current version of Tableau Desktop. Instead, we need to create three calculated fields and drag them to filter the corresponding chart.

 

Step3: Create a new dashboard and drag the vertical container into the canvas. Then stack the three charts into the container with the Tiled mode. After that, hide the titles of the three charts in the drop-down list.

 

Step4: At last, switch the value of the parameter to see if the chart type changes accordingly.

Feel free to reach out to me on LinkedIn, if you have any questions.

 

Share this post