KNOWLEDGE BASE

How to Merge Categories with Calculation Fields


Published: 29 Jan 2024
Last Modified Date: 29 Jan 2024

Question

How to use a calculated field to merge the shared Sub-categories in the data source into the Category column.

For example,
"AME" subcategory exists in every category.
User-added image

Environment

  • Tableau Desktop

Answer

1. Create a calculated field [Category(New)]
IF [Sub-Category]="AME" THEN "AME"
ELSE [Category]
END


2. Add [Category(New)] to the view to replace the old [Category]. Notice that "AME" category is added.
User-added image

Please check "Sample.twbx" for details. 
Did this article resolve the issue?