How to Concatenate Fields in Tableau?

While creating a Sales performance report using Tableau, I wanted to show the Category and Subcategory of the product in the same column. For example, the category “Furniture” was in one column and “Chairs” in another. However, for the report, I wanted them to appear together as a single label, likeĀ ‘Furniture-Chairs’.

To display both the dimension label in a single column, I concatenated the fields “Category” and “Subcategory” using a calculated field.

In this Tableau tutorial, I will explain how to concatenate Fields in Tableau using different use case scenarios.

Concatenation in Tableau

In Tableau, concatenation is the method of joining two or more text, date, or number fields together into a single field to create a new, combined field. We can perform concatenation by using the plus sign (+) operator within a calculated field. This also works for non-text fields to convert them into strings by using the STR() function along with the (+) operator in a calculated field.

For similar fields like Order date and Ship date, we can also use the combined field option, but unlike concatenation, the combined field will be separated by a comma, and it will be displayed as “Category, Subcategory“.

Concatenate Fields in Tableau

In the examples below, we will concatenate the strings and number fields using the calculated field.

Concatenate Two Strings in Tableau

In this example, we will concatenate two string fields, Category and Subcategory, in a Tableau text table.

Now, connect the Tableau with the Superstore dataset and follow the steps below.

  1. To create a calculated field, go to the navigation bar and select Analysis -> Create Calculated Field.
Concatenate fields in Tableau
  1. To concatenate the string fields “Category” and “Subcategory,” enter the formula below. After this, validate the formula and click OK.
[Category] + " - " + [Sub-Category]

In the same way, we can concatenate multiple strings in Tableau using the “+” operator.

  1. To create the view, add a concatenated field on the Rows, then add the measure, such as Sales, on the Columns.