How to Create a Union in Tableau

Cody Schneider8 min read

Trying to analyze data that’s split across multiple files or spreadsheet tabs can be incredibly frustrating. If you have monthly sales reports in separate CSVs or yearly performance data in different Excel sheets, you need a way to bring it all together before you can see the big picture. This is where Tableau's Union feature becomes your best friend.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

A union lets you stack these datasets on top of each other, creating a single, comprehensive table for your analysis. This article will walk you through exactly how to create a union in Tableau, covering both the manual drag-and-drop method and the powerful wildcard union for an automated workflow.

What Exactly is a Union in Tableau?

Think of a union as simply stacking rows of data from multiple tables vertically. For a union to work correctly, the tables you're combining should have the same structure. This means they should have the same number of columns, and those columns should contain similar information with matching data types.

Imagine you have three separate Excel sheets for sales data from the first quarter of the year: January_Sales, February_Sales, and March_Sales. Each sheet has the same columns: Order Date, Product Name, Region, and Sales Amount.

A union would take all the rows from the January sheet, then stack all the rows from the February sheet underneath them, and finally add all the rows from the March sheet at the bottom. The result is one master table for Q1_Sales that you can analyze as a whole.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Union vs. Join: What’s the Difference?

It's easy to confuse unions with joins, but they accomplish very different things. While a union stacks data vertically, a join adds data horizontally by matching rows based on a common field.

  • Use a Union to add more rows. This is for when your data is split into similar files (e.g., monthly reports). The number of columns stays the same, but the number of rows increases.
  • Use a Join to add more columns. This is for when you need to enrich a table with additional details from another table. For example, joining a Sales table with a Product_Details table using a common Product ID column to add product descriptions and categories.

In short, if your files look like pieces of a single, longer list, you want to perform a union.

When Should You Use a Tableau Union?

Unions are perfect for consolidating data that has been partitioned for organizational or technical reasons. Here are a few common scenarios where a union is the ideal solution:

  • Consolidating Time-Based Data: You have transactional data exported monthly, quarterly, or yearly. A union lets you combine Sales_2022.csv, Sales_2023.csv, and Sales_2024.csv into a single dataset to analyze trends over time.
  • Combining Regional or Departmental Data: Your company stores sales data in separate files for each region (North_America_Sales.xlsx, Europe_Sales.xlsx, Asia_Sales.xlsx). A union allows you to create a global sales dashboard.
  • Merging Log Files: System or web logs are often generated as separate files for each day. You can union log_2024-10-21.txt, log_2024-10-22.txt, etc., to analyze user behavior over a specific week or month.
  • Working with Survey Results: If you've collected survey responses in batches, a union can help merge them into one master file for a complete analysis.

How to Create a Union in Tableau: A Step-by-Step Guide

Tableau offers a couple of straightforward ways to create a union. Let's start with the most direct method: manually dragging and dropping your tables.

Method 1: Manual Union Using Drag-and-Drop

This method is best when you have a small, fixed number of tables you need to combine. It's intuitive and gives you full control over which files are included.

Let's use our quarterly sales reports example, where we have three separate sheets in a single Excel file named Q1 Sales Data.

  1. Connect to Your Data: Open Tableau and on the "Connect" pane, select "Microsoft Excel". Navigate to and select your Q1 Sales Data.xlsx file.
  2. Go to the Data Source Page: After connecting, Tableau will take you to the Data Source page. In the left pane, under "Sheets", you'll see your three sheets: Jan_Sales, Feb_Sales, and Mar_Sales.
  3. Drag Your First Table: Drag the Jan_Sales sheet onto the canvas area. Tableau displays the data in the grid below.
  4. Create the Union: Now, drag the Feb_Sales sheet from the left pane and hover it directly below the Jan_Sales table on the canvas. You'll see an orange box appear with the text "Drag table to union". Drop the Feb_Sales sheet onto this box.
  5. Add More Tables: Your union is now created with two tables. To add the third, simply drag Mar_Sales and drop it onto the existing unioned table on the canvas.

That's it! Your three sheets are now stacked into a single logical table. If you scroll through the data grid, you'll see the data from January, followed by February, and then March.

Tableau's Helpful Additions: Path and Table Name

After you create a union, you might notice two new columns added to your dataset: Table Name and Path (or Sheet if you're unioning Excel worksheets). These fields are automatically generated by Tableau and are incredibly useful.

  • Table Name/Sheet: This column contains the name of the original table or sheet that each row came from. In our example, its values would be Jan_Sales, Feb_Sales, or Mar_Sales. This allows you to easily filter, group, or color your visualizations by the source month.
  • Path: If you're unioning files from a folder (like multiple CSVs), this column shows the full file path for each original file.
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 2: Automatic Union Using a Wildcard Search

Manually dragging tables is fine for a few files, but what if you get a new sales file delivered every day? Adding it manually each time would be tedious. This is where wildcard unions save the day.

A wildcard union automatically finds and combines all files in a folder (or sheets in an Excel file) that match a naming pattern you specify. It's a classic "set it and forget it" solution.

Let's say you have a folder named "Daily Sales Reports" containing CSV files named Sales-2024-10-21.csv, Sales-2024-10-22.csv, and so on.

  1. Connect to Your Data: In Tableau, connect to "Text File" and select any one of the CSV files in your folder.
  2. Drag a Sheet to the Canvas: Once on the Data Source page, drag the file's icon from the left pane to the canvas.
  3. Convert to Union: Now, from the left pane, drag the New Union object onto your canvas and drop it onto your existing Sales-2024-10-21.csv table. A dialog box will appear.
  4. Configure the Wildcard Union:

The beauty of this method is that when a new file like Sales-2024-10-23.csv is added to the folder, Tableau will automatically include it in the union the next time you refresh your data source. No extra work required.

Troubleshooting Common Union Issues

Sometimes unions don't work perfectly right away. Here are solutions to a few common problems.

Problem: Mismatched Column Names Leading to Nulls

What happens if one sheet has a column named Sale_ID and another has it as SalesID? Because unions match columns by name, Tableau will treat these as two separate columns. This results in a wide table with a Sale_ID column that is null for all the rows from the second file and a SalesID column that is null for all rows from the first file.

Solution: Merge Mismatched Fields

Tableau makes fixing this simple. In the Data Source page's data grid:

  1. Select the first column (e.g., Sale_ID).
  2. Hold the Ctrl key (Cmd on Mac) and select the second column (SalesID).
  3. Right-click on either selected column header and choose Merge Mismatched Fields.

Tableau will combine them into a single column, correctly populating the data from both sources.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Problem: Inconsistent Data Types

Another common issue is when a column has a different data type across files. For example, a Units Sold column might be a number in one file but a string (text) in another because someone accidentally included text characters.

Solution: Change Data Type

This is also an easy fix on the Data Source page. Click the icon at the top of the column that represents its data type (e.g., # for number, Abc for string). From the dropdown menu, select the correct data type for the whole column. Tableau will attempt to convert all values.

Final Thoughts

Unioning data in Tableau is a fundamental skill for anyone working with partitioned datasets. Whether you use the simple drag-and-drop method for a few files or set up an automated wildcard union for ongoing reports, combining your data sources is the first step toward uncovering game-changing insights. Mastering this technique saves you from the headache of manual data wrangling in spreadsheets and lets you focus on creating powerful visualizations.

While mastering tools like Tableau is a valuable skill, sometimes you just need an answer without wrestling with data prep. We built Graphed to streamline this whole process. You can connect your data sources in seconds, and instead of manually unioning tables, you can just ask a question in plain English, like "Show me my total sales across all regions for this year." Graphed automatically understands your data relationships and builds a real-time dashboard for you, turning hours of data wrangling into a 30-second task.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!