In Tableau a parameter is a tool that can be used to add interactivity to a view or dashboard, allowing the audience to explore the data for themselves. They can also be used to help organise a dashboard. Today we’ll be looking at using parameters to switch between different charts. The following video is the finished product:

 

 

We’ll be doing this using a parameter with a filter. While there are other ways to do this, different methods have different advantages. Either way using parameters to switch between charts is a great way to fit many different charts on the same dashboard and can even be used to view the same data but with a different chart type eg. From a line to a bar chart.

Step by step guide

I’ve got 2 charts prepared using the World Indicators sample data which comes with tableau (along with superstore). Alternatively you can do the following with any 2 (or more) charts.

  1. Create a new parameter

2. Use the following settings

    • Data type: String
    • Allowable values: list

In the ‘list of values’ pane put in the names of your charts under ‘value’ on separate lines. Then click ok.

  1. In the bottom of your data pane (bottom left of screen) you should have your newly created parameter. Right click and select show. Now you should be able to see it on the right side of your view. Use the drop-down on this box to change it to ‘single value list’. Use this to flick between the parameter options.

  1. Next create a calculated field from the same menu as the parameter was created, and simply put the parameter field in there (you can drag it from the data pane if you like).

For the final steps I’ve created a video which is at the end. However the instructions have a bit more explanation as to what is happening:

  1. Create a new dashboard. Place the sheets side-by-side in a container. This helps keeps the views in the same position when you have multiple charts on your dashboard. To do this drag a horizontal or vertical object onto the dashboard and then drag the sheets into the container one after the other, making sure that the second chart is within the container (When dragging the second chart you should have a solid box appearing around your first chart). You’ll also need to hide the titles of each chart.

6. Now we need to tell tableau what to show when each parameter is selected. This is done using filters. I’ll describe how to do this using my example sheet names. Navigate to the population sheet, select ‘population’ on the parameter and drag the calculation we made in step 4 onto the filters box. In the pop-up tick the box for the ‘population’ chart (this should be the only box). Now this chart will only appear when that parameter is selected.

7. Now do the same for the health expenditure sheet, except with health expenditure on the parameter and health expenditure checked in the pop-up box.

8. Now go back to your dashboard and select the change view parameters to make sure its working correctly.

 

Frank Salmon
Author: Frank Salmon