KNOWLEDGE BASE

Create a Parameter to Enable/ Disable a Specified Filter


Published: 31 Jan 2022
Last Modified Date: 09 Feb 2022

Question

How to create a parameter to enable/ disable a specified filter.

Environment

  • Tableau Desktop.

Answer

Step 1: Create a Parameter

  1. Click the down arrow next to Dimensions in the data pane and select Create Parameter…
  2. In the Create Parameter dialog, do the following and click OK:
    1. Name the parameter [Activate the category filter?]
    2. For Data Type, choose Integer.
    3. For Allowable values, select List
    4. Add two options to the list:  0 for "Deactivate" and "1"  for activate
  3. Right-click [Activate the category filter?] in the data pane and select Show Parameter Control.

Step 2: Create the following Calculated fields

  • Select Analysis > Create Calculated Field...
       Create a Calculated Field called "Category Filter Controller" using the following formula:
 
    CASE [Activate the category filter ?]
    WHEN 0 THEN NULL
    WHEN 1 THEN [Category]
    END

Step 3: Enable the Activate Filter calculated field

  • Drag [Category Filter Controller] to the Filters shelf.
  • In the Filter dialog, check an option being displayed and click OK.
Did this article resolve the issue?