KNOWLEDGE BASE

Searching a Field for a Specific Word or Substring and Filtering


Published: 28 Jun 2013
Last Modified Date: 13 Mar 2014

Question

How to search for a specific word or a sub-string in a field and then filter the view based on the result.

Environment

Tableau Desktop

Answer

  1. In Tableau Desktop, connect to Superstore Sales sample data.
  2. Drag the necessary fields into view. In the attached workbook, drag Category and Sub-Category to Rows and drag Sales to Text.
  3. Select Analysis > Create Calculated Field.
  4. In the Calculated Field dialog box that opens, enter a name for the field. The attached workbook uses Search Filter.
  5. In the formula field, create a calculated field similar to the following and then click OK:
    Contains([Sub-Category], "office")
    Where [Sub-Category] is the field name and "office" is the specific word or string you want to search for. 
  6. Drag the new calculated field from the Dimensions pane to the Filter shelf.
  7. In the Filter dialog box that opens, select True, and then click OK.

Did this article resolve the issue?