Tableau Concatenate: Comprehensive Guide + Tutorial

Published: March 20, 2024 - 5 min read

Julian Alvarado

Concatenation in Tableau is a powerful technique that can significantly improve your data visualizations by allowing you to combine multiple pieces of information into single, coherent fields.

Whether you’re just starting out or looking to refine your skills, this guide and tutorial will show you how to effectively use concatenation in Tableau.

Understanding Concatenation in Tableau

Concatenation links two or more fields to form a single string or text field, an essential feature in Tableau when aiming to provide more informative labels or blending different data points for a comprehensive analysis.

Preparing your data correctly is key to making the most out of this feature.

Coefficient simplifies this process by seamlessly importing and synchronizing the most current data from various business systems into your spreadsheets. This not only saves time but also enhances the accuracy of your visualizations.

Take Klaviyo’s experience, for example. Read their story here.

Facing challenges from ad hoc data requests and the absence of automated reporting, they needed a solution that integrated with spreadsheets as they scaled.

Coefficient helped Klaviyo make self-serve analytics a reality by  centralizing and automating reporting, and helping the data team reclaim months of their time previously lost to manual data extracts

Basic Concatenation Techniques

Tableau facilitates concatenation through two primary means: the CONCAT() function and the straightforward “+” operator.

While the CONCAT() function is explicitly designed for merging text fields, the “+” operator offers a more intuitive approach,** allowing for the seamless combination of strings directly.

Using the “+” Operator for Concatenating String Fields

The “+” operator is your go-to tool for quickly joining two or more string fields. Its simplicity shines when you need to merge, for instance, first and last names to display full names in your visualizations.

It’s crucial, however, to tailor the formula to fit your needs, adding spaces, punctuation, or other separators to ensure the concatenated result reads naturally. For example, to merge city and country fields with a comma, you’d construct a formula akin to [City] + “, ” + [Country].

Tableau Concatenate String with Non-string Values

Often, the data you wish to concatenate encompasses more than just strings, including dates or numerical fields. Tableau’s STR() function converts these non-string values into strings, enabling their seamless integration into your concatenated fields.

This technique proves invaluable when you’re looking to create comprehensive addresses from separate components or unique identifiers that combine a date of sale with a product name.

Step-by-Step Tutorial: How to Concatenate Fields in Tableau

Step 1: Preparing for Concatenation

Start by identifying the variables you wish to concatenate. In this example, we want to concatenate “City” and “Country” into one field.

Viewing variables in Tableau's data source to prepare for concatenation.

Note: Utilizing Coefficient’s one-click data connectors can simplify this initial step, allowing for easy import and sync of your business data into the spreadsheet, ensuring a streamlined start to your concatenation process in Tableau.

Step 2: Creating a Calculated Field for Concatenation

Proceed to “Sheet 1,” double-click on “City,” then go to “Create” and choose “Calculated Field.”

Starting a calculated field for concatenation in Tableau.

Name your variable as “City and Country.” After selecting “City,” drag “Country” into the calculation field. Insert a plus sign (+) for concatenation.

Coefficient Excel Google Sheets Connectors
Try the Free Spreadsheet Extension Over 500,000 Pros Are Raving About

Stop exporting data manually. Sync data from your business systems into Google Sheets or Excel with Coefficient and set it on a refresh schedule.

Get Started

Step 3: Refining the Concatenation Formula

Add a comma and space between “City” and “Country” for legibility. You’ll be notified that the calculation is correct.
Naming the calculated field for city and country concatenation in Tableau.

Confirm the calculated field by clicking “Apply” and “OK.” The newly formed variable will be visible on the left-hand panel.

Adjusting the concatenation formula for better readability in Tableau.

Step 4: Verifying the Concatenated Field

Check the accuracy of the concatenated field by dragging “City” into rows, then “Country,” and finally the “City and Country” variable.

Completing the calculated field creation for city and country concatenation.

The formula’s effectiveness is demonstrated by combining “Atlanta” with “United States” into “Atlanta, United States.”

Advanced Tableau Concatenate Techniques

Handling Null Values with IFNULL

A common challenge you may encounter during concatenation is dealing with null values, which can disrupt the intended outcome, resulting in incomplete or misleading information. Tableau’s IFNULL function allows you to specify a default value for cases where a field is null, ensuring your concatenated fields remain informative even with missing data points.

For example, using IFNULL([City], ‘Unknown City’) + “, ” + IFNULL([Country], ‘Unknown Country’) replaces any null values with ‘Unknown City’ or ‘Unknown Country’, maintaining the coherence of your data narrative.

Here’s where Coefficient can significantly amplify this process: by leveraging its real-time data refresh feature, Coefficient ensures that any default values set through the IFNULL function in Tableau are constantly updated with the most accurate information from your spreadsheets.

Concatenating Multiple Fields with Separators

When concatenating multiple fields, especially with the ambition to incorporate legible separators like hyphens, commas, or spaces, the use of a mix of the CONCAT() function and “+” operators becomes crucial for clarity. For intricate concatenations like compiling a three-part address using CONCAT([Street Address], “, “, [City], “, “, [Country]), it’s essential to maintain clarity between each data component.

Coefficient’s bi-directional 2-way synchronization shines in these scenarios.

An image showing Coefficient from a spreadsheet

By ensuring that adjustments made in your spreadsheets—such as adding, removing, or updating fields—are accurately and promptly reflected back in your Tableau visualizations and vice-versa, Coefficient facilitates a highly flexible and responsive data management framework.

Conclusion

The versatility of concatenation in Tableau opens up a myriad of possibilities for enhancing your data visualizations. We encourage you to explore these techniques in your Tableau projects to discover new depths in your data storytelling.

Want to make things even easier? Start your journey with Coefficient today.

Connect Tableau to Spreadsheets Instantly

Automatically sync Tableau with Google Sheets or Excel using Coefficient’s one-click connector.

Try the Spreadsheet Automation Tool Over 500,000 Professionals are Raving About

Tired of spending endless hours manually pushing and pulling data into Google Sheets? Say goodbye to repetitive tasks and hello to efficiency with Coefficient, the leading spreadsheet automation tool trusted by over 350,000 professionals worldwide.

Sync data from your CRM, database, ads platforms, and more into Google Sheets in just a few clicks. Set it on a refresh schedule. And, use AI to write formulas and SQL, or build charts and pivots.

Julian Alvarado Content Marketing
Julian is a dynamic B2B marketer with 8+ years of experience creating full-funnel marketing journeys, leveraging an analytical background in biological sciences to examine customer needs.
500,000+ happy users
Wait, there's more!
Connect any system to Google Sheets in just seconds.
Get Started Free

Trusted By Over 50,000 Companies