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.
- To create a calculated field, go to the navigation bar and select Analysis -> Create Calculated Field.

- 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.
- To create the view, add a concatenated field on the Rows, then add the measure, such as Sales, on the Columns.

In the calculated field column, we can see the concatenated values of Category and Subcategory displayed like Furniture-Chairs.
This way, we can concatenate two string fields in Tableau by using a (+) operator in the calculated field.
Concatenate String With Non-String Values in Tableau
In Tableau, when we concatenate a string with a non-string field like a number, integer, or float, then it will return an error, as we cannot add numerical values to string values.
For this, we need to add STR() with the number field to convert the numeric values in string and concatenate them.
In this example, we will concatenate the fields Customer ID (number) and Customer Name (string).
- To create a calculated field, click on the Analysis tab and select Create Calculated Field.

- Enter the Label as Customer Name & ID, then enter the formula below. After validating the formula, click OK.
[Customer Name] + " (ID: " + STR([Customer ID]) + ")"Here we use STR() function to convert the numeric Customer ID into text (string).
- To view the values of the concatenated fields, add the calculated field to the Rows and then add measures like Sales and Profit to the Columns.

In the Tableau text table, we can see the concatenated values of the fields Customer Name and Customer ID.
This way, we can concatenate the string and number values in Tableau by using the STR() function in the calculated field.
Concatenate Two Number Values in Tableau
In Tableau, there are scenarios when we need to create a unique identifier by combining two numeric fields. Since Tableau does not allow direct concatenation of numbers, we must first convert them into text using the STR() function.
In this example, we will concatenate the number fields Postal Code and Row ID.
- In the Taleau navigation bar, click Analysis -> Create Calculated field.
- Enter the label for the calculated field, and follow the syntax of the formula below to concatenate the number fields.
STR([Postal Code]) + "-" + STR([Row ID])Here, first we have converted the number values to strings using the STR() function and then concatenated them using the “+” operator.
- Now, drag the concatenated field to the Rows and then add measures like Sales and Profit to the Columns.

In the concatenated field column, we can see the concatenated values of Postal Code and Row ID.
This way, we can concatenate two number fields in Tableau by first converting them to a string and then concatenating using the “+” operator.
Concatenate Fields With Null Handling in Tableau
When concatenating fields in Tableau, we can get issues if one of the fields is NULL (blank). If we try to concatenate these nulls directly, Tableau will return NULL for the entire expression instead of avoiding the blank field.
As a solution for this, we can use functions like IFNULL() for strings or ZN() for numbers.
Concatenate Strings With Null Handling in Tableau
In this example, we will concatenate the string values Customer Name and Region. The dataset I’m using has a few Region values as blank.
Now, we will use the IFNULL() function to handle the null values to concatenate the string values.
Create the calculated field and enter the following formula to concatenate the string fields Customer Name and Region.
[Customer Name] + " - " + IFNULL([Region], "Unknown")Now, add the calculate field to the Rows and Sales measure to the Text card in the Marks section.

In the table, we can see that the blank or null Region values are marked as none, and the user name is still displayed.
This way, we can handle null values while concatenating string values in Tableau by using the IFNULL() function.
Concatenate Numbers With Null Handling in Tableau
While concatenating number fields in Tableau, if one of the fields is NULL, Tableau won’t display anything for that value. For example, we have concatenated the Postal Code and Row ID, and if Row ID is null, then the concatenated field won’t display the Postal Code either.
For this, we can use the ZN() function that converts a NULL numeric value into 0. With this, if an order has no postal code, then zero will be displayed for null or blank values.
Now, create a calculated field using the formula below to handle NULL values while concatenating the number fields.
STR(ZN([Row ID])) + "-" + STR(ZN([Postal Code]))In this formula, we have first converted the Number field to a string using the STR() function, and to return 0 for null values, we have used the Zn() function.
Now, add the calculated field to the Rows and Customer Name to the Text card in the Marks section.

In this table, we can see that the null values for the postal code are displayed as 0.
This way, we can handle null values in Tableau number values concatenation by using the ZN() function.
Conclusion
In this Tableau tutorial, we have learned how to concatenate fields in Tableau. By following the examples above, we can concatenate strings to strings, numbers to numbers, and strings to numbers.
We also covered how to handle NULL values to avoid errors in the results. By using functions like STR(), IFNULL(), and ZN(), we can concatenate values in Tableau along with handling null values to build clear tables and charts in Tableau.
You may also like to read:

Abhijeet is a skilled Salesforce developer with experience in developing and integrating dashboards, data reports, and Salesforce applications. He is also skilled at optimizing processes and flow automation processes, coding, and executing complex project architecture. Read more about us | LinkedIn Profile.