This post steps through my approach for creating the dashboard from this video that contains a number of dynamic zone visibility (DZV) calculations. For an introduction to this feature, please see my previous post.
Five Analysis Scenarios
This example uses five scenario calculations. The purpose of these calculations is to uniquely identify five different analysis scenarios, each representing a different way of exploring the same dataset:
- Focus on a single sub-category
- Comparison of multiple sub-categories
- Compare a category or sub-categories across all regions
- Focus on a single region
- All sub-categories at the order ID level of detail
Below is an image of the same dashboard with each of the five scenarios showing based on a different selection of marks.
These scenario calculations are shown later in this blog. They depend on a number of other calculations, however, which I’ll cover first.
Total Dimension Values
This first set of calculations returns the total number of each item in the dataset, for example, total regions:
Similar calculations are created for:
- Region + Sub-Category (this is a concatenation of these two fields)
Number of Dimension Values Selected
This next set of calculations returns the number of each item selected, for example, total regions selected.
- Create a set based on each item, for example, s.Region based on the field Region.
- Create the below calculation which counts the distinct number of that item in the set.
- Create a set action on the controlling chart to update each set.
Similar calculations are created for:
- # of Categories Selected
- # of Orders Selected
- # of Sub-Categories Selected
- # of Region + Sub-Categories Selected
Enable Allow selection by category
In the section above I mentioned creating a set action to update the relevant set for each dimension. These set actions can also be triggered by selecting the relevant dimension in the tooltip if Allow selection by category is enabled in the tooltip:
Five Analysis Scenario Calculations
With the above calculations created, we can now move on to the five scenario calculations.
The calculation for each scenario returns either True or False. If True, then the container that contains the charts for that scenario will show and all other containers will not show as their respective calculations will return False.
Notice that all calculations are wrapped in a fixed LOD. See my previous blog post for more on the requirements for dynamic zone visibility calculations but, essentially, each calculation can only ever return one single result across the dataset.
One caveat here. The purpose of building this dashboard was to experiment and demonstrate some use cases for DZV, so these calculations won’t account for every possible use case including filtering the data source or using them with other data sources. Please adjust as needed for your own use cases.
Scenario 1 – Focus on a single sub-category
Condition: A single sub-category is selected.
Scenario 2 – Comparison of multiple sub-categories
Condition: Multiple sub-categories are selected, however, not a combination of sub-categories that satisfy the conditions for scenarios three, four or five.
Scenario 3 – Compare a category or sub-categories across all regions
Condition: The same sub-category is selected across all three regions OR all sub-categories within a category are selected across all three regions.
Note, there is a parameter action in place here to capture the Category that the user selects.
Scenario 4 – Focus on a single region
Condition: All sub-categories are selected within one region only.
Scenario 5 – All sub-categories at the order ID level of detail
All sub-categories across all regions are selected.
A few extra calculations
Aside from the five main scenario calculations, there are a few other calculations:
- 3a and 3b control which title is shown at the top of the scenario three container as it can be either for a single sub-category across regions or for all sub-categories within one Category across regions. These two calculations are applied directly to their respective text objects and not the container.
- 5a and 5b control which chart is shown underneath the scatter plot in scenario five. If five items or fewer are selected, a table is shown. If more than five marks are selected, the strip plot is shown. These two DZV calculations are applied directly to the respective charts that they control the visibility for.
- Again, all the above calculations return either True or False based on the marks selected.
Create one Container of Charts per Scenario
The collection of charts that you want to show for each scenario should be placed in their own container. When the dashboard is complete, each of these five containers will occupy the same space and position (for this example), however, when creating and populating them with charts, you may find it easier to place the containers side-by-side, as below, or to float the active one you are working on so it’s on top and then tile it in with the others as you go:
Apply Dynamic Zone Visibility to each Container
Select one of the containers and, in the Layout panel, check the box labelled Control visibility using value. Then, from the menu below, navigate to the corresponding boolean calculation. Here, I have the container for scenario five selected so am selecting calculation 5 from the list. Now this container will only show when that calculation returns True, i.e. when all sub-categories across all regions are selected in the view.
Repeat the above process for each container, with one dynamic zone visibility calculation assigned to each container. As you do this, you’ll see that each container will disappear except for the one container that meets the current selection state. You can then format the view and sizing as needed.
Apply Dynamic Zone Visibility to Headers or Charts
In this example, for scenario three I use the same container of charts but the header/title changes based on if the user has selected one sub-category across all three regions or if they have selected all sub-categories within the same category across all three regions. Therefore two titles are created and the relevant visibility calculation applied to each text object:
For scenario five, I also show one of two charts underneath the scatter plot based on the number of order IDs selected.
- Fiver or fewer orders shows a table of details
- More than five orders selected shows a strip plot chart
Therefore DZV calculations are applied to each of these charts – 5a and 5b in the above screenshot.
The video below walks through this dashboard and how it was constructed
The workbook can be downloaded from my Tableau Public profile here.
Dynamic Zone Visibility is a powerful new feature with many possible use cases for customising and personalising the dashboard experience. I hope the above examples were useful. I’ll create a video tutorial soon that steps through some of the above creation process. If you have any questions, you’re welcome to contact me on Twitter or LinkedIn (links below).
Latest YouTube video
This video demonstrates combining Cloudinary’s dynamic image creation service with Tableau’s new Image Role feature.