By: Eric Parker
Eric Parker lives in Seattle and has been teaching Tableau and Alteryx for 5 years. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email.
After creating a parameter that lets you swap worksheets in a Tableau dashboard, one of the problems is that when a worksheet goes blank (because it is swapped away from), the color legends associated with that worksheet also temporarily go blank.
Let’s use this simplified example from the previous section as our test case. Notice how when the map is showing, the color legend below the maps displays well:
Here’s what happens when the visual is switched to display the bar chart:
Not as good of a look. Additionally, notice the different dimensions being used. On the “Map” view, the State field is the most granular dimension. On the “Bar Chart” view, Customer Name is the most granular dimension.
This poses another problem because this is what the map color legend should look like:
And this is what the bar chart color legend should look like:
Notice those ranges are drastically different.
The solution is to create a third worksheet that doesn’t get swapped out. The first step is to create a field that switches the dimension to match either the “State” or “Customer Name” level of granularity.
The next step is to create a worksheet using that field that automatically adjusts based on what is selected in the parameter.
Finally, you float the color legend worksheet in the dashboard (and eventually make it so small it’s unnoticeable). At the same time you want to replace the old color legend with the new one.
With this new setup it doesn’t matter what is selected in the parameter, the range of the color legend will reflect the data range on the worksheet that’s displaying and be dynamic.
Notice how the range is different between the two previous images.
Need help with your own visuals? Sign up for an office hour and we can tackle them together.