How to merge columns in Tableau
By the Analistable team · Updated · 5 min read
For a quick merged dimension, select two or more fields in the Data pane, right-click and choose Create → Combined Field. For full control of the text, create a calculated field such as [First Name] + " " + [Last Name]. Wrap numbers in STR() and nullable fields in IFNULL(..., ""), because in Tableau adding text to a null returns null.
Part of our guide: How to merge data in Power BI, Power Query and Tableau
Combined field or calculated field
| Combined field | Calculated field | |
|---|---|---|
| Created by | Right-click → Create → Combined Field | Analysis → Create Calculated Field |
| Output | A dimension combining the members of each field | A text field you define |
| Separator | Tableau's default, shown as a comma-separated label | Anything you type |
| Good for | Grouping and sorting by a combination | Labels, keys, tooltips, exports |
Combined fields are for analysis: they let you treat Region + Category as one dimension, for example to sort bars by the pair. Calculated fields are for text you will read or reuse, such as a full name or an address line.
Create a combined field
- In the Data pane, Ctrl-click (Cmd-click on a Mac) two or more dimensions, for example Region and Category.
- Right-click one of them and choose Create → Combined Field.
- Tableau adds a field named something like “Region & Category”. Drag it to Rows or Color.
To change the fields it contains, right-click it and choose Edit Combined Field. Combined fields work on dimensions only; measures can't be included.
Concatenate with a calculated field
Choose Analysis → Create Calculated Field, name it and type a formula. The + operator joins strings:
// Full name
[First Name] + " " + [Last Name]
// Order label with a number and a date
"Order " + STR([Order ID]) + " – " + STR(DATE([Order Date]))
// Key for matching another source
UPPER(TRIM([Region])) + "|" + UPPER(TRIM([Product Code]))Using + between a string and a number gives an error, so convert numbers with STR(). For a date in a fixed format, recent versions also offer DATENAME and DATEPART, or you can build the parts yourself, for example STR(YEAR([Order Date])) + "-" + RIGHT("0" + STR(MONTH([Order Date])), 2).
Nulls make the whole result null
If any part of a + expression is null, the result is null. That is why merged labels sometimes go blank for a handful of rows:
| First | Middle | Last | [First]+" "+[Middle]+" "+[Last] | With IFNULL |
|---|---|---|---|---|
| Ana | Maria | Lopez | Ana Maria Lopez | Ana Maria Lopez |
| Tom | null | Reid | null | Tom Reid |
| Priya | null | Shah | null | Priya Shah |
IFNULL([Middle], "") stops the null spreading, but leaves a double space. To avoid that, add the separator only when the value exists:
[First] + IIF(ISNULL([Middle]) OR [Middle] = "", "", " " + [Middle]) + " " + [Last]Merging columns from two data sources
A calculated field can only reference fields from one data source unless the sources are related or blended. If First Name is in a CRM extract and Region is in a spreadsheet, relate the two first on a shared key, as described in joining data sources in Tableau, then build the calculation on the combined logical table. In a blend, fields from the secondary source must be aggregated, for example ATTR([Region]), which makes row-level labels awkward; a relationship is usually better.
Performance and tidy-up
- String calculations are computed for every row. On large live connections, consider creating the merged column in the database or in Tableau Prep instead.
- In an extract, calculated fields can be materialised at extract time, which speeds up dashboards.
- Name calculated fields clearly (“Customer Label”), and add a comment line starting with // to explain unusual logic.
- Hide the original columns in the Data pane if users should only see the merged version.
The worksheet equivalent is covered in combining two columns in Excel, and Power Query users can read Power Query Merge Columns. In Analistable, a merged label is just part of the SQL it writes, for example concat_ws(' ', first, middle, last), which skips nulls without extra logic. The Power BI, Power Query and Tableau guide lists more options.
Splitting is the reverse
Tableau can also do the opposite. Right-click a string field and choose Transform → Split or Custom Split to break “Lopez, Ana” into two fields at the comma. Split works best with a consistent separator, which is another reason to choose one carefully when you merge. In calculations, SPLIT([Label], "|", 1) returns the first part and SPLIT([Label], "|", 2) the second.
| Key | SPLIT(...,1) | SPLIT(...,2) |
|---|---|---|
| NORTH|KT-17 | NORTH | KT-17 |
| SOUTH|TS-02 | SOUTH | TS-02 |
| WEST|KT-17 | WEST | KT-17 |
If you build keys like these to relate two sources, apply exactly the same calculation, including UPPER and TRIM, on both sides. A difference in one character means the rows don't relate, and the related fields show as null.
Combined fields have a further use worth knowing: they can drive a dashboard filter action or a set on two dimensions at once. A calculated text key cannot always be used the same way for sorting, because it sorts alphabetically rather than by the underlying members.
If you work with Tableau Prep, the same logic applies there: a calculated field in a Clean step can join columns with +, and the result is written into the output file, so every workbook that uses the output gets the merged column without repeating the calculation. That is often the tidiest choice when several dashboards need the same label or key, because the rule lives in one flow rather than in each workbook.
Frequently asked questions
- How do I concatenate two fields in Tableau?
- Create a calculated field with [Field1] + " " + [Field2]. Wrap numbers or dates in STR() first.
- Why is my concatenated field null for some rows?
- In Tableau, joining a string with a null gives null. Wrap optional fields in IFNULL([Field], "") or test them with ISNULL.
- What is a combined field in Tableau?
- A dimension made from two or more other dimensions, created by selecting them, right-clicking and choosing Create → Combined Field. It is useful for grouping and sorting by a pair.