KNOWLEDGE BASE

Display Specific Characters in a String as Tags


Published: 20 Jun 2022
Last Modified Date: 08 Jul 2022

Question

How to identify and display specific characters in a string as tags.

User-added image
 

Environment

  • Tableau Desktop

Answer

Below is an example of tagging the Product Name field of the Sample - Superstore data with specific characters.

1. Prepare the characters you want to use as tags in a separate table.

User-added image

2. Connect to the Sample - Superstore and drag the Orders table to the canvas.
3. Add a connection to the Tags table and drop it on the canvas.
4. Create a calculation such as "1 = 1" as join clauses to cross-join tables.

User-added image

5. Create a calculated field in a new worksheet and name it Tags.
IF CONTAINS([Product Name], [Characters]) THEN [Characters] END
     If the characters used as tags are case-insensitive, enter the formula as follows:
IF CONTAINS(LOWER([Product Name]), LOWER([Characters])) THEN [Characters] END

6. Add Product Name and Tags fields to the Rows shelf.

7. Add the Tags field to the Filters card and uncheck NULL.
 
Did this article resolve the issue?