Use Parameters to Add Multiple Views to Your Viz

By Ross Perez July 28, 2015

One of the things I like most about using Tableau is experimenting with different types of visualizations. But what if the people who are viewing my dashboard want to be able to switch between different types of charts and graphs as well? Here are several different ways of accomplishing that.

1. Switching between a Bar Chart and a Line Chart

This is a fairly simple trick that is detailed much more eloquently by Andy Kriebel here. Create a parameter that has two options, either a bar chart or a line chart. Then create two calculated fields, one for each value. They are the same calculated field, but the beginning is a little different for each one. The bar chart option reads "if[Parameter]="Bar" then [Profit] else null end". The line chart option reads "if[Parameter]="Line" then [Profit] else null end.

To finish the job, place these together as a dual axis chart, then make sure to select a "Line" visualization type for the Line calculation on the Marks card. Since each of the calculated fields will have a null value when the parameter is on the other choice, one of them will always be null. For the finishing touch, synchronize axes.

2. Showing Sub-Category on Demand

If an end user wants to drill into a hierarchy with many values in Tableau, the query can create a visualization that is too large to view in one viz. This trick makes it possible to drill into a secondary dimension, but only on selected values.

First create a parameter that has the values of the first level category or dimension in your hierarchy. Then create a very simple calculated field to replace your second level category/dimension: "if[Parameter]=[Category] then [Sub-Category] else "" end".

After replacing the original sub-category field on the view with the new calculated field, only the selected input category will show sub-category.

3. Switching between Different Visualizations on a Dashboard

What if my colleague wants to switch between a map and a bar chart on a dashboard? Well, the endlessly innovative Alan Smithee found a great way of doing just that. Simply create a parameter that has the input of either a bar chart or a map. Then create a calculated field to filter out whichever view isn't selected in the parameter—something like: "if[Parameter]="Bar" then 1 else 0". Then repeat the opposite for the second visualization, and filter on each view so that only values of 1 are visible.

Now add each visualization to a dashboard container, hide the titles, and make sure the parameter is available. Switching between views becomes just a flick of a switch.

Here's a more detailed explanation of the tips:


Submitted by Cliff B. on

Thank you so much for the insight! I continue to be amazed on what Tableau can do and wish I could use this everyday!

Submitted by Ravindra S. on

Nice one.

Submitted by Hrvoje G. on

Great video. In first example we can add parameter next to Y axis so when we switch parameter so name of Y axis can also change :)

Submitted by Melanie (not verified) on

Love this! Not only functional but easy. Keep up the good work!

Submitted by Jon (not verified) on

nice tip. Any reason the javascript viz wasn't placed into post so we can play with it (rather than a screencap)?

Submitted by Alison (not verified) on

Ross, you rock. Thanks for consolidating 3 very useful applications of parameters in a viewing of less than 10 mins!

Submitted by Yilmaz (not verified) on

Great! Loved this video!

Submitted by Grant (not verified) on

Very cool Ross. Is there a way to 'Show subcategory on demand' if you are using groups? I've grouped some records together to make a simple view for end users. But it would be cool to allow them to easily expand on that group without having to drill down into the underlying data.

Submitted by rebecca l. on

good info good presentation! thanks!

Submitted by Mahesh Gujar (not verified) on

Really helpful. :) Thank You.

Submitted by Allen (not verified) on

Extremely clever! This can actually be applicable to many other types of tools as well!
Thank you! =)

Submitted by Manoj (not verified) on

good stuff to do more dynamic actions.... amazing tricks

Submitted by Manoj (not verified) on

good stuff to do more dynamic actions.... amazing tricks

Submitted by Stephen S. on

Thanks for the tips, useful stuff, am about to get to applying them

Submitted by Gabino Javier S... (not verified) on

Very Nice. Thank you.

Submitted by Amit M. on

Really very Nice but i have one question.

Under first trick bar/Line it is showing some null on right bottom corner. How to manage those values if i am using this tricks.

Submitted by Baiju (not verified) on

Very helpful! Thank you for the post

Submitted by Dataviz Vicky (not verified) on

I think you can right click on the null that is showing and select hide indicator. That should remove it from showing :)

Submitted by Dataviz Vicky (not verified) on

This is really helpful and awesome. Thank you, Ross!!

Submitted by tommy (not verified) on

Great tips - thx for sharing!

Submitted by Shok Yee Y. on

This is really awesome!
But is there possible for us to use chart instead of parameter?
For example, by hovering around the map, it will show respective country's sales performance but it will show overall details (like sales and profit of all countries) when no country is selected.

Submitted by Hrvoje G. on

Dashboard -> Actions -> Add filter -> Filter... -> Choose hover and choose leave the filter option

Submitted by johanrobert (not verified) on

thank you for sharing this is awesome information

Submitted by Mahesh (not verified) on

Changing chart type on fly is good idea. But can I have more than 2 choices? Because we are using Dual Axis feature here - but I want to have support more than 2 chart types (Line, Bar and Bubble).

I can think of creating more than 3 sheets and managing hide/show sheet based on parameter selection.

But the idea you gave is nice - that way I don't duplicate my sheets.


Add new comment

non-humans click here