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.


Tony Tan
Author: Tony Tan