When working with data in Tableau, you’ll often find the need to display long text or labels in a more readable format.
This is where the text-wrapping feature in Tableau comes in handy. Text wrapping allows you to present long strings of text in a way that they fit within the available space.
Locate the cell containing the text you want to wrap.
In the format pane, turn the wrap on. Click and drag the edges of the row or column headers to adjust the size of the cell.
As you resize the cell, Tableau will automatically wrap the text to fit the new dimensions of the cell.
You can also use calculated fields with CHAR function to wrap text. This method gives you precise control over where the text wraps.
In this article, we’ll explore the various methods you can use to wrap text in Tableau. Each method will have examples to help you better understand the concepts.
By the end, you’ll have a solid understanding of how to make your text and labels look clean and professional in your Tableau visualizations.
Let’s dive in!
3 Step to Wrap Text in Tableau
In this section, we will cover the 3 steps you need to easily wrap text in Tableau.
Step 1: Create a View
Drag and drop a dimension or measure from your dataset into the Rows or Columns shelf.
For demonstration, we will drag the ‘Product Name’ dimension to the Rows shelf and Sales to the column shelf.
You can see that the product names do not fit the current allotted cell size. Therefore, we’ll have to wrap the text in these cells.
Step 2: Turn The Wrap On
Right-click on any of the product names, and select Format.
In the formatting settings, click on the Alignment dropdown menu and turn the wrap on.
Step 3: Adjust the Column Width or Row Height
Hover over the right edge of the ‘Product Name’ column header until the cursor changes to a horizontal line with arrows.
Click and drag the edge to the left to make the column narrower. As you reduce the width of the column, you’ll notice the product names start to wrap to fit the new width.
In the above view, you can see that the text is now wrapped to the cell size.
How to Wrap Text Using The CHAR Function
Using the CHAR function in Tableau to manually insert line breaks for text wrapping is a more controlled approach.
Follow the steps below to wrap text using this method:
Step 1: Create a Calculated Field
Right-click in the Data pane and check for “Create Calculated Field.”
Step 2: Insert Line Breaks with CHAR Function
In the calculated field formula box, you will use the CHAR(10) function to insert line breaks.
For instance, if you want to wrap the product name, your formula might look something like this:
LEFT([Product Name], 20) + CHAR(10) + MID([Product Name], 21)
This formula breaks the ‘Product Name’ field into two parts: the first 20 characters and the rest, inserting a line break between them.
Step 4: Use the Calculated Field in Your View
Drag the newly created calculated field (“Wrapped Product Name”) to Rows or Columns on your worksheet, depending on where you need it.
Tableau will now display the product names with the manual line breaks you’ve defined in the calculated field.
In the above screen shot, the product names are wrapped and easily readable. The problem with this method, however, is that it is not responsive. If you reduce the column width, the wrap will not work. Calculated fields wrap texts only to the current view.
Learn Advanced Data Analytics from OpenAI by watching the following video:
Final Thoughts
Wrapping text in Tableau is one of the trending topics in the world of data visualization. It is a simple but effective way to improve the readability and aesthetics of your visualizations.
Furthermore, it’s important to remember that the readability of your visualization plays a crucial role in conveying your message to the audience.
So, whether you’re using automatic wrapping by adjusting column widths or inserting manual line breaks with calculated fields, each method adds significant value to your visualizations.
Learning the small details like wrapping text will take you time, but it is crucial since it allows you to make your data more accessible and engaging for your viewers.
Happy Data Visualizing!
Frequently Asked Questions
In this section, you will find some frequently asked questions and other related conversations you may have when wrapping text in Tableau.
How do I wrap text in Tableau without a measure name?
In Tableau, to wrap text without using a measure name, adjust the width of the column or the height of the row containing your text.
This manual resizing will automatically prompt Tableau to wrap the text to fit the adjusted cell size.
Can you wrap text in a table?
Yes, in Tableau, you can wrap text in a table based on manually adjusting the width of columns or the height of rows.
This resizing causes the text within cells to automatically wrap to fit the new dimensions.
How to wrap text in a table in Tableau Public?
In Tableau Public, to wrap text in a table, adjust the column widths or row heights where the text is displayed.
As you resize, Tableau Public will automatically wrap the text to fit within the new dimensions of the cells.
How to wrap long text in Tableau?
To wrap long text in Tableau, resize the column or row where the text is located by dragging its borders, which will cause Tableau to automatically wrap the text within the adjusted cell dimensions. Tableau will give you an error if there is nothing found in a specified cell.
Alternatively, you can use a calculated field with the CHAR(10) function to insert manual line breaks.