In the essence of sharing knowledge, I wanted to share a way that I got around a problem I was having with a dashboard at work. For this post, I’ll be using the Sample Superstore data source that comes with Tableau. I’ve attempted to isolate and replicate my issues as closely as possible.
The Problem
In a dashboard that I’m building for a client, we are utilizing parameter swapping pretty extensively. I have two parameters:
- What do you want to analyze?
- This is the sheet swapping element. Users can swap between analyzing:
- Geographic Variation
- Sub-Category
- This is the sheet swapping element. Users can swap between analyzing:
- View By:
- This parameter allows the user to swap the measures being analyzed
- Sales
- Profit
- This parameter allows the user to swap the measures being analyzed
Up to this point, this pretty straightforward/standard Tableau parameter work. If you’d like to or need to learn how to do that feel free to download my workbook and reverse engineer it to your needs.
But my problem came when I went to create the dashboard. Dashboarding best practices requires that you show the user a legend for any measure that’s being encoded. This means that when we put a measure on color to create a sequential or diverging color scale, we have to show the legend (if we don’t show the min/max values of the domain in a different way).
Consider the following:
This looks great. We have sales on color and we can see the measure filter on the right to show the color scale.
But what happens when the users what to analyze something else? And that on the next view DOES NOT have the measure on color
Oh man, this is not good. Now, that legend starts to get confusing to new users. There are many ways that I COULD do this:
- put sales on color for the bar chart as well
- Yep, I could do that but what if I have multiple different bar charts on this dashboard as well? Would I need to put sales on color for every bar chart in my dashboard?
- Get rid of the legend all together all together and label the min & max values on both the bar chart AND the map
- Another good option but, depending on all the other things on the dashboard, my data:ink ratio would start to get compromised a bit.
What I’d really like to do is have the legend hide away with the sheet when I swap away from it. For my situation, that would be ideal.
After some trial and error, I figured it out. I created a sheet that resembles a legend which allows me to utilize the parameter filter to show and hide different sheets. Check out the gif below that I created to see and click to see the workbook itself.
So how did I do it? It’s much simpler than it looks.
- I start by duplicating the worksheet with the map.
- Use “Show Me” to quickly change the worksheet to bar chart stacked bar chart
- I use the Ctrl+W keyboard shortcut. This swaps rows and columns
- Ctrl+click and drag my Measure field to color
- Right click on my dimension on the detail shelf and select “Sort”
- Sort descending the measure on color
- Click the “Label” card and select to show only Min/Max Values
- Now just remove borders and gridlines and the heavy lifting is complete
One thing that I noticed when I put it on the dashboard is the axis needs some attention because the labels get squished into the line making the values difficult to read. I used some table calcs and reference lines to get around that.
I hope you learned a little something today
Until next time!