KNOWLEDGE BASE

Excluding Values from a Filter


Published: 22 Mar 2013
Last Modified Date: 13 Aug 2018

Question

How to limit the values available in a filter.

Environment

Tableau Desktop

Answer

The attached example workbook uses the sample data set Superstore to demonstrate all three options.


Option 1: Use a Set as a Filter

  1. Right-click [Product Container] in the data pane, and select Create > Set…
  2. In the Create Set dialog, do the following and click OK:
    1. Check all options that should appear in the final filter card
    2. Name the Set something like Product Container Set
  3. Remove [Product Container] from the Filters shelf
  4. Drag [Product Container Set] to the Filter shelf

Option 2: Exclusion Filter Using Only Relevant Values 

  1. Right-click [Product Container] in the data pane, and select Duplicate
  2. Drag [Product Container (copy)] to the Filters shelf
  3. In the Filter dialog, check all options that should appear in the final filter card and click OK
  4. Right-click the Product Container card in the view and select Only Relevant Values

Option 3: Use a Parameter as a Filter (can be used with blended data)

  1. In the data pane, right-click the [Product Container] field and select Create > Parameter…
  2. Tableau Desktop will automatically populate the values of [Product Container] in the parameter. In the Create Parameter dialog box, do the following and click OK
    1. Add "All" to the List of values
    2. Remove all options that should not appear in the final filter card
  3. Right-click [Product Container Parameter] in the data pane and select Show Parameter Control
  4. Select Analysis > Create Calculated Field
  5. 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 "Product Container Filter Calc"
    2. In the formula field, create a calculation similar to the following:

      [Product Container] = [Product Container Parameter] OR [Product Container Parameter] = "All"
  6. Replace [Product Container]  on the Filters shelf with [Product Container Filter Calc]
  7. In the Filter dialog, check True and click OK

Additional Information

Note: For all three options, any fields excluded from the filter will also be excluded from the view.

The calculation in option 3 can be modified to not filter out values excluded from the parameter control. For example, the following calculation:

[Product Container] = [Product Container Parameter]
OR [Product Container Parameter] = "All"
OR [Product Container] = "Medium Box"

To view options 1 and 2 in action, see the video below: 
Did this article resolve the issue?