Is it possible to create a dashboard that allows you to both swap sheets and to conditionally hide and show parameters depending on which sheet is in display? Yes, of course! In this post, I am going to walk you through how to combine these two tricks and show you how I applied them to your dashboard.
Our goal is to produce something like this:
You can check out the viz I use to explain this process on my Tableau Public, where you can download the workbook to see my calculations and parameters. If you want to create your own dashboard, head over to Makeover Monday Week 26 and download the data.
Let’s get started!
Using parameters to swap sheets is a great solution when we want to avoid cramming a dashboard with too many graphs, but we still want to make them all available to our users. Here’s how:
One of the two sheets need to include the parameter(s) we would like to hide. In my case I created
Create a parameter called “View complete map or Top/bottom map”. Set data type to string and allowable values equal to the names of the sheets we want to swap:
Show parameter control (by clicking on the parameter in the data pane and selecting “Show parameter”) and display it as a single-value list
Use the parameter in a calculated field that you can call “Swap sheets” by simply writing the parameter name into it, like so:
Drag the calculated filed “Swap sheets” onto the filter shelf of our two sheets. and select only the name of the that specific sheet. In the case of my viz
This part is a bit tricky, so I am adding a video to illustrate how it works:
Now that we have learn how to swap sheets, let’s go ahead and hide our parameters. We have our dashboard with swappable sheets and three parameters:
What we want to achieve is to literally push our parameter up and out of the view when the Complete map sheet is showing, and down into the view when the Top/bottom map is showing. Due to this method, it is important to put our parameter on top of our viz. (Of course, you can adapt and apply this method for the sides and bottom of the viz, too. If you wish to keep your parameters in the middle of the sheet, that is also possible, but it comes with some limitations, since the users might inadvertently click on the blank sheet and disturb/confuse their experience).
I draw heavily from Andrew’s post in this section, definitely check out his blog for more.
This can be achieved by creating two Blank sheets, and setting them so that they react to our Sheet-swapping parameter in opposite ways. I am going to follow Andrew’s advice and color the sheets in green and red for the time being, so that the explanation is visually more clear. Of course the colors are completely arbitrary and in any case they will need to be white/transparent in the end.
To create the blank sheets, create a blank calculation by typing “ “ into the editor and name it “Blank”.
Add the Blank calculated field to rows. Change the background color by right-clicking on the view, selecting “Format” and changing the Default worksheet color. Repeat for the second sheet.
In the dashboard, add a floating layout container and drag the parameter into it. Then drag the green blank sheet at its top and the red blank sheet at its bottom. For now, it should look something like this:
Create a calculated field that will be used as a filter, by using our Sheet-swapping parameter “View complete map or top/bottom map” and setting it equal to the name of the sheet for which we want to hide the parameters. In this case, I want to hide the two parameters when the dashboard shows the Complete Map:
After dragging our “Complete Map Filter” calculated field to the filter shelf of both blank sheets, make sure to
This will make sure that when we select the “Complete map” in the Sheet-swapping parameter, the green sheet, which is on top of the parameter, will disappear. Having more space in the container, the red sheet at the bottom of the parameter will expand and push the parameter up.
Conversely, the red sheet, which is at the bottom of the parameter, will disappear when we select the Top/bottom map, and this will give space to the green sheet to expand and push our parameter down and into the view.
If you are still confused, check out how the sheets appear and disappear in this video:
Select the layout container and change its Y position to a negative number big enough for the parameter to be pushed out of the viz when the sheet-swapping parameter displays the complete map, but small enough so that the parameter is visible when the top/bottom map is displayed.
Play around with the Y-coordinate’s position until you are satisfied, then change the background color of the blank sheets to white or transparent.
Duplicate the green and red blank sheets and repeat steps 2, 3 and 4 for the second parameter.
Congrats for making it so far! Now you can swap sheets and hide parameters whenever you want!
Here my final viz. What will you create?
Wanna learn more about Tableau or Alteryx? Do you want to use these tools to their full potential? Check out our trainings and consultancy services!