KNOWLEDGE BASE

Filtering to an Entire Group a Member Belongs To


Published: 01 May 2018
Last Modified Date: 03 May 2018

Question

How to filter a view to the group a member belongs to.

For example, after picking one product, and then seeing all products in the same category as the chosen product.

Environment

Tableau Desktop

Answer

Use a parameter to select the product, and then use a FIXED expression to create a filter that will return the same value for all rows within a group. The attached example workbook uses the sample data set Superstore to demonstrate the following directions:

Step 1: Create a parameter

  1. In the data pane, right-click the [Product Name] field and select Create > Parameter…
  2. In the Create Parameter dialog box, name the parameter. In this example I will call the parameter "Type in product name"
  3. Right-click [Type in product name] in the data pane and select Show Parameter Control

Step 2: Create a calculated field

  1. Select Analysis > Create calculated field
  2. Name the calculated field "Selected Product's Category Filter"
  3. Enter a formula similar to the following and click OK
    { FIXED [Category] : MAX([Product Name] = [Type in product name])}

Step 3: Filter your view

  1. Drag the new calculated field [Selected Product's Category Filter] to the Filters shelf
  2. In the Filter dialog, check True and click OK.

Additional Information

Explanation of the above FIXED calculation:
  1. We determine which rows in the underlying database have a product name matching the name chosen in the parameter.
    • Note, the expression [Product Name] = [Type in product name] will only return TRUE on rows that contain a selected product.
  2. The FIXED expression will return the maximum of [Product Name] = [Type in product name] for every unique value of [Category].
    • TRUE is considered "bigger" than FALSE.
    • In other words, if any row within a category contains TRUE, then the FIXED expression will return TRUE for all of the rows for that category.
Did this article resolve the issue?