Sheet Swapping in Tableau with Dynamic Zone Visibility

//

Dynamic Zone Visibility entered the Tableau toolkit with Tableau 2022, and it’s a game changer for sheet swapping.

Prior to the existence of Dynamic Zone Visibility, there were a couple of options to swap sheets in Tableau. The long article at this link covers sheet swapping using the parameter technique, and sheet swapping using show/hide container. Both of those techniques are valid and are useful to have in the developer toolbox.

However, Dynamic Zone Visibility is simplest and best way to swap sheets. This article will demonstrate how to swap sheets using Dynamic Zone Visibility.

What is Dynamic Zone Visibility?

Dynamic Zone Visibility applies to all objects. It means that any object can be visible, or not visible, with a click. This includes containers, and hiding a container also hides the contents of the container. Which is great for sheet swapping.

Dynamic Zone Visibility (DZV) triggers by a Boolean calculation or a Boolean parameter. Boolean values are simple – they either return True or False. Which, for sheet swapping, is the same as Show or Hide.

How to activate Dynamic Zone Visibility for sheet swapping

This is exactly the same example as in the earlier Tableau sheet swapping guide. The example includes two objects per container, that will swap in or out depending on user selection.

To set up the DZV for sheet swapping, we need:

  • A Boolean parameter
  • A Boolean calculated field
  • 3 horizontal containers
  • The sheets to show and hide – there are 4 sheets in this example
A boolean parameter in Tableau
Notice the True and False aliases

Using the parameter, create a Boolean calculation. This calculation is to return the inverse of the parameter – so when the parameter is True, the calculation returns False, and vice versa.

A Tableau calculated field producing the inverse of a boolean parameter
The inverse of a boolean parameter

Therefore, LTLA items go into a container only for LTLA, and UTLA into a container only for UTLA items.

Set up the dashboard containers for sheet swapping with dynamic zone visibility

Now to the containers. And this can get fiddly. Name the containers and use colour & blanks to help. Also, the containers and contents are tiled; there’s nothing floating in this example.

We want the LTLA items in the LTLA container, the UTLA items in the UTLA container, then both the LTLA and UTLA containers inside a master container. Placing items inside a container means they expand to fill the space.

Start by putting a container for UTLA and adding the UTLA chart and map. Colour the border green to help placement.

Add another horizontal container, and colour the border orange. Place the LTLA chart and map within the new container.

When the dynamic zone visibility is active, and the sheet swapping is working, we want the visible container to fill the entire space. To do this, both UTLA and LTLA containers also need to be in a container. Objects within a container can expand and contract to fill the space. So, add another horizontal container. Add a border if that will help “find” it to add items. Putting a blank in there can be useful – here the blank has a thin black border, the container a thick pink border.

Tableau dashboard with blank container between two other containers
A container containing a blank is in the centre of this dashboard

Add both the UTLA container, and the LTLA container to this container.

Tableau dashboard with multiple containers for sheet swapping
The blank item, now at the bottom, helped guide the other items into the container

Once the charts are within their containers, and the containers are within the main container, delete the blank. Next, is to switch on the Dynamic Zone Visibility.

How to Switch on the Dynamic Zone Visibility

Dynamic Zone Visibility, which we use to swap the sheets, runs using Boolean values.

The parameter driving the visibility, UTLA LTLA DZV, is visible on the dashboard, but it’s not hooked up to anything yet. So, to hook it up…

Select the container with the UTLA charts.

Hint – to select the container, select one of the objects within the container, for example a chart. Double click the white lines at the top of the object, and that automatically selects the object container.

In the Boolean parameter, UTLA is the alias for True. With the UTLA container selected, click Layout. Check the box Control visibility using value. Then choose the Boolean parameter built for this exercise.

Set up Dynamic Zone Visibility to a Tableau dashboard using a boolean parameter
Control the DZV using a parameter

That will hide the UTLA container when LTLA is selected.

There’s another step to hide the LTLA container. For that, we need another Boolean value, also created earlier, returning the inverse of the parameter.

Set up Dynamic Zone Visibility in a Tableau dashboard using a boolean calculated field
This time use a boolean calculated field for DZV, which returns the inverse of the aforementioned boolean parameter

Only boolean calculated fields and boolean parameters appear within the list of options. If you’re not seeing any parameter or calculated fields to use, ensure they are boolean data type.

And that’s it. Test, then remove the container border colour. Everything should work, sheet swapping using dynamic zone visibility is active!

To see this technique in action, and others techniques, check the Sheet Swapping Guide in Tableau Public.

Leave a Comment