KNOWLEDGE BASE

Conditionally Show or Hide Parameter Controls, Filters, Web Objects, or Legends


Published: 05 Nov 2015
Last Modified Date: 20 Jul 2023

Issue

When Conditionally hiding a viz then associated filters, parameters legends, or web objects always show

For example: 
  • If a dashboard swaps worksheets based on a parameter selection, then all parameter controls, filters, and legends associated with both worksheets will always show even when one of the worksheets is hidden.
  • Or, a worksheet does not show until a user triggers a Filter Action, then parameter controls, filters, and legends for that worksheet always show.

Environment

  • Tableau Desktop

Resolution

The attached example workbook uses the sample data set Superstore to demonstrate the following workarounds.

Example 1: Using a parameter to show/hide a viz

This examples starts by building a view using the directions in Create a Sheet Selection Menu for a Dashboard 
 

Option 1 - Use Dynamic Zone Visibility 

Starting in Tableau Desktop 2022.3 Dynamic Zone Visibility allows any element (views, filters, legends, containers, etc...) to be hidden based on a calculation that returns True or False. See Configure a dynamic dashboard zone

In the example workbook that can be downloaded from the right-hand pane, a view and all of its associated elements are placed in one container and then dynamic zone visibility is configured for that container. The containers have been given different colored borders. See the Additional Information section for tips.
 

Option 2 - For filters only, set Filters to show Only Relevant Values and hide filter titles

This option does not work for dropdown filters and will leave white space where the hidden filter is.
  1. Right-click the [Category] Filter and uncheck Show Title.
  2. Right-click the [Category Filter] and select Only Relevant Values.
  3. Repeat steps 1-2 for the [Segment] filter.

Example 2: View Excluded until Filter Action Triggered

See the "Action Filter Exclude All Values" dashboard in the workbook downloadable from the right-hand pane of this article for directions on how to create the example.

Option 1 - Use Dynamic Zone Visibility 

Starting in Tableau Desktop 2022.3 Dynamic Zone Visibility allows any element (views, filters, legends, containers, etc...) to be hidden based on a calculation that returns True or False. See Configure a dynamic dashboard zone

In the example workbook that can be downloaded from the right-hand pane, uses the following directions starting from the "Action Filter Exclude All Values" dashboard:
Step 1: Create the Boolean Calculation
  1. Right-click [Region] in the left-hand data pane and select Create > Set...
  2. In Create Set dialog, click OK
  3. Navigate to the dashboard
  4. Navigate to Dashboard > Actions...
  5. In the Actions dialog select Add Action > Change Set Values...
  6. In the Add Set Action dialog, do the following:
    1. For Source Sheets, check only Bar Chart
    2. For Run action on, choose Select
    3. For Target Set, choose Region Set
    4. For Running the action will, choose Assign values to set
    5. For Clearing the selection will, choose Remove all values from set
  7. Navigate to a worksheet
  8. Select Analysis > Create Calculated Field
  9. In the Calculated Field dialog box that opens, do the following, and then click OK:
    1. Name the calculated field. In this example, the calculated field is named "Any Region Selected?"
    2. In the formula field, create a calculation similar to the following: { FIXED : MAX([Region Set])}

Step 2: Configure Dynamic Zone Visibility

  1. Navigate to the dashboard
  2. Click on the Profit legend
  3. In the lefthand side bar, navigate to the Layout tab
  4. Check Control visibility using zones
  5. In the dropdown, select Any Region Selected?
 

Option 2: Replace the element with a worksheet

Not all elements can be replaced with a worksheet, and depending on the element the directions to create a worksheet will differ. The example workbook that can be downloaded from the right-hand pane uses the following directions starting from the "Action Filter Exclude All Values" dashboard:

Step 1: Create a worksheet legend

  1. Create a new worksheet called "Fake Color Legend"
  2. Drag [Profit] onto Columns
  3. Drag a second copy of [Profit] onto Color on the Marks card
  4. Drag [State] onto Detail on the Marks card
  5. Select Analysis > Create Calculated Field
  6. In the Calculated Field dialog box that opens, do the following, and then click OK:
    1. Name the calculated field. In this example, the calculated field is named "ABS Profit for Sorting"
    2. In the formula field, create a calculation similar to the following: ABS( SUM([Profit]))
  7. Right-click [State] on the Marks card and select Sort...
  8. In Sort dialog, do the following:
    1. For Sort by, select Field
    2. For Sort Order, select Descending
    3. For Field Name, select ABS Profit for Sorting

Step 2: Replace the legend with the worksheet

  1. Navigate to the dashboard
  2. Remove the Profit color legend
  3. Add the "Fake Color Legend" worksheet to the dashboard. By default Tableau will add the new view as a target sheet for existing action filter.

Additional Information

Tips for working with dynamic zone visibility:

  • Once dynamic zone visibility is configured, then Tableau considers the elements to be stacked even if some aren't shown. You may not able to add, move, or resize elements that are "underneath" invisible zones. To avoid this, complete dashboard formatting before configuring dynamic zone visibility.
  • Shared filters can be added to the dashboard from all worksheets, which allows a shared filter to be included in every conditionally shown container
  • Only one copy of a parameter can be added to a dashboard. To always show the parameter, it can be added as a floating element above a blank object in each container

Did this article resolve the issue?