KNOWLEDGE BASE

How to Replace Comma/Space With Line Break in Tableau Desktop


Published: 19 Aug 2022
Last Modified Date: 19 Aug 2022

Question

How to separate the data by replacing comma/space with line breaks?

For example, in the below data, the dimension [City] has multiple values in a cell. How to show them with a line break instead all the items in a line?
User-added image

Environment

  • Tableau Desktop

Answer

Please use the REPLACE() function to replace the comma/space with a line break in the dimension.

The sample calculation is as below.

Replace comma: REPLACE([Dimension], ",", CHAR(10))
Replace space: REPLACE([Dimension], " ", CHAR(10))

The results are like the below image.
User-added image

* Please also check the attached workbook for details.

Additional Information

The meaning of CHAR(10) could be found in the ASCII Table below.
[ASCII Table]
Did this article resolve the issue?