How to Add Two Columns in Tableau
Adding two columns together is a fundamental task in data analysis, allowing you to create new metrics and dimensions from your existing data. In Tableau, this is most often done by creating a calculated field. This article will walk you through exactly how to add both numeric and text columns, handle common issues like null values, and apply aggregations correctly.
Why Would You Need to Add Columns in Tableau?
Before jumping into the how-to, let's quickly cover a few scenarios where adding columns is a necessary step. It's a common data preparation task that unlocks deeper insights.
- Creating New Metrics: You might want to combine
SalesandShipping Feesto get aTotal Order Value. Or maybe addProduct CostandMarketing Costto understand the total investment per item. - Combining Text Fields: A classic example is combining a
First Namecolumn and aLast Namecolumn to create aFull Namefield. This makes labels on charts and tables much cleaner. - Calculating Custom KPIs: While not always simple addition, many key performance indicators (KPIs) start by combining multiple fields. For example, understanding total variable costs might involve adding
Material Costs,Labor Costs, andShipping Costs.
Essentially, adding columns allows you to create a more complete and analysis-ready dataset directly within Tableau, without having to go back to your original spreadsheet or database.
How to Add Two Numeric Columns Using a Calculated Field
The most direct way to sum two columns is by creating a calculated field. This generates a new column (a "field" in Tableau terminology) in your data pane that you can use just like any of your original columns.
Let’s use a common e-commerce example. Imagine you have a dataset with columns for [Sales] and [Shipping Cost]. You want to create a new column called Total Price that is the sum of these two.
Step 1: Open the Calculated Field Editor
First, navigate to the Data pane on the left side of your Tableau worksheet. You'll see your list of dimensions and measures.
Click the small downward-facing arrow at the very top of the Data pane. From the dropdown menu, select Create Calculated Field…
Alternatively, you can right-click anywhere in the empty space of the Data pane and select the same option.
Step 2: Name Your New Field
A dialog box will pop up. The first thing you should do is give your new field a descriptive name. In this case, we'll type Total Price into the name box at the top.
Step 3: Write the Addition Formula
This is where the magic happens. In the large text area of the dialog box, you'll write the formula to add your columns. The syntax is straightforward: you reference your column names and place a plus sign (+) between them.
To add the Sales and Shipping Cost columns, your formula will be:
[Sales] + [Shipping Cost]
As you start typing, Tableau's autocomplete feature will suggest field names from your data source. You can select [Sales], and as you continue typing, it will help prevent typos in your field names, which is a common cause of errors. At the bottom of the dialog box, you'll see "The calculation is valid." If there's an error, Tableau will tell you what's wrong so you can fix it.
Step 4: Save and Use Your New Field
Click OK to save your calculated field. You will now see Total Price appear in your Data pane under the Measures section (since it’s a number). It will have a small sign that indicates it's a calculated field.
Now you can use this Total Price field just as you'd use either column. Drag it onto the Rows or Columns shelf, drop it onto the Marks card to add color or as a label, or use it in other calculations. Tableau automatically summarizes all values, giving you a SUM[Total Price] pill.
Adding Text Columns (Concatenation)
Sometimes, adding means joining two string fields instead of calculating their sum. This is called concatenation. For example, you want to combine a First Name column with a Last Name column to get a Full Name.
Step 1: Create a Calculated Field
Repeat the Step 1 from the previous section to open the Calculated Field editor. Name your field Full Name.
Step 2: Write the Concatenation Formula
Your formula will include a + sign to join the two names. To accomplish this, you simply add a space character enclosed in quotes between the two names.
[First Name] + " " + [Last Name]
Without the space, your resulting field would be JohnSmith, which is not ideal. By adding the space, you create a readable name like "John Smith".
Dealing with Common Problems
When creating calculated fields, you may encounter null values in columns. To deal with this, you can use functions like ZN() to convert nulls to zero for numerical calculations.
A Quick Note on Aggregation
When you place calculations in your Tableau view, you’ll notice that Tableau automatically wraps your field with an aggregation, like SUM(), AVG(), or MIN(). The formula we wrote earlier, [Sales] + [Shipping Cost], is a row-level calculation. This means the calculation is performed for every single row in your data source before any aggregation happens.
In most cases, this is exactly what you want. You want to calculate the Total Price for each individual order first, and then sum up all the total prices later to get the grand total.
However, you can also perform the calculation at an aggregate level. The formula would look like this:
SUM([Sales]) + SUM([Shipping Cost])
The result is often the same, but the order of operations is different. Here, Tableau first sums up all the values in the [Sales] column, then sums up all the values in the [Shipping Cost] column, and then adds those two grand totals together. For simple addition, both methods work, but understanding the difference between row-level and aggregate calculations is vital as your formulas become more complex.
Final Thoughts
Knowing how to add columns via calculated fields is a foundational skill in Tableau. Whether you're summing numeric data to create new performance indicators or concatenating text fields for clearer labels, the process remains simple and consistent. By also learning how to handle potential issues like null values with the ZN() function, you can ensure your analyses are always accurate and reliable.
While the calculated field editor in Tableau is powerful, it does come with a learning curve. We created Graphed because we believe getting insights from your data shouldn't require you to learn special syntax or memorize function names. You can just connect your data sources - like Shopify, Google Analytics, or Salesforce - and ask questions in plain English, like "Show me a chart of total sales plus shipping costs over the last quarter." We handle the logic and build the visuals instantly, turning hours of report building into a 30-second conversation.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?