Tableau Tips: Dynamic charts (By leveraging Parameter & Layout container)
Updated: Sep 3, 2020
In the last two months, i have been training a group of industry experts on data decision making. This whole training was based on data the industry has been consuming in traditional manual way. The training was part of mental preparedness to usher a new modern tool for data reporting. Being a modern tool, a lot of excitement was expressed by attendees who found the tool quite solution oriented. To mention a few take from the training;
Pushing governed data/insights to the users, this meant users of the tool will no longer have to make calls to their experts to gain insights, but rather will utilize the tool to make their decision.
Insight for everyone - Although the business need vary from one persona to another, the tool will allow each persona have their data needs addressed. Should i say, same data,different persona's need, same tool solution.
Insights every where - The new tool will give users the flexibility to glean insights wherever they are as long as they have access to internet, using their, laptops, desktops and even mobile phones.
Besides these advantages, I learned one big difference within same persona's. There was a notable difference in how users prefer to consume insights. For instance, there were some cases users would prefer to use a line chart over a bar chart and vice-versa. This kept me thinking, could there be a way to enable each user choose the chart they would like to use? Doing this will enable developers satisfy the demands of varying persona's. Therefore this article seeks to explore one of the ways to solve this challenge in your current project using Tableau parameter and layout container.
Step 1: Build a Bar Chart
Connect to Superstores data set above, build a simple Bar chart with dimension Sub-Category and Measure Sales.
Drag Sub-Category to the Column(s) shelf.
Drag Sales to the Row(s) shelf.
Change Marks card to a Bar.
Step 2: Build a Line Chart.
Repeat step 1, note under marks card to choose Line.
Step 3: Create a String Parameter.
Introducing a parameter will give the user flexibility to chose chart of choice. To do so, go to Create >> Parameter..>> Rename it 'Select Chart' >>Choose 'String' under data type >> Enter 'Bar' & Line under list of values.
Step 4: Create a Calculated Field.
Now, lets create a calculated field to help us show or hide charts based on what is selected in the parameter.
Step 5: Apply Filters.
Now lets apply the calculated fields in Step 4, as filters in the respective charts. Open the sheet with Bar Chart, drag measure field 'Show Bar' to the filter and select as show below.
Repeat the same, in the sheet with Line Chart, but this round use the field 'Show Line'.
Step 6: Create Dashboard.
Now, we are ready to go. Lets compile the charts in the dashboard.
Add vertical layout container.
Drag both chart into the container. (beginning with the visible chart).
Hide the Titles.
Show our parameter 'Select Chart'.
Floating our parameter and positioning it, we've.
And there we've it, assuming you need to show more than two charts in the same dashboard. The same procedure will be applicable. I hope this article was informative and enjoyable as well. See you in the next articles on sharpening your Tableau Skills. Cheers.