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:

Comments

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

Very Nice. Thank you.

Nice one.

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 :)

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

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

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

Great! Loved this video!

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.

good info good presentation! thanks!

Really helpful. :) Thank You.

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

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

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

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

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.

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

Very helpful! Thank you for the post

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

Great tips - thx for sharing!

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.

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

thank you for sharing this is awesome information

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.

Regards,
MB


Add new comment