Tableau Tip - Swapping entire views using a parameter

by Jack Parry

Given that I haven’t posted a blog in a while, I thought I’d ease back into it with this handy tip which I used recently on a client project here at the Data School. In some scenarios, you may want to free up some space on your dashboard by providing the option to swap out entire views (usually different chart types) using a parameter. I’m going to walk through this with some easy to follow steps.

Step 1 Create two (or more) views

Create your two views that you want to flip between. In this example, I have a running sum of sales for each year and a table containing the sales by category by year.

Step 2 Create a parameter

Create a parameter for your two (or more) charts, for my example I have labelled them by their chart types i.e. line chart and table. You will then want to show this parameter control on both of your views.

Step 3 Calculated field

Create a calculated field which equals your parameter, see the image below.

Step 4 Set up parameter

First I set up the parameter control for the line chart. On the line chart worksheet make sure the parameter control is set to line chart and then add the calculated field to the filters card. In the filter select ‘line chart’ (this should be the only option as ‘line chart’ is what the parameter is set to. Repeat the process for the table, setting the parameter control to table and applying the filter. Now when you change the parameter to ‘line chart’ in the table worksheet, your view should disappear.

Step 5 Set up dashboard

On your dashboard, put the two sheets that you want to flip between into the same container and hide the titles. The parameter control should have automatically come through to your dashboard and you should be able to flip between the two views!

Step 6 Dynamic Title

Although your user can see which view is selected from the parameter, it is helpful to make this clearer with a large dynamic title. To do this, create a new worksheet and add your calculated field to the text shelf on the marks card. Play around with your sizing and add this to your dashboard above your dynamic chart and you have yourself some dynamic worksheets!

I hope you find this simple yet effective trick useful in your own work! I’m hoping to pick up the blogging again after some time out so check out my blog here!