How to Union Two Tables in Tableau
Combining data from separate files or spreadsheets into a single, cohesive view is one of the most common challenges in data analysis. If you have monthly sales reports, weekly lead lists, or an export from a different ad platform for each campaign, you know the headache of trying to report on everything at once. This guide will walk you through exactly how to use the Union feature in Tableau to stack your data together, creating one unified table for cleaner, smarter analysis.
What Is a Table Union? (And Why It’s Different from a Join)
Before jumping into the steps, it's important to understand what a union actually does. Think of it like stacking Lego blocks on top of each other. A union appends rows from one table to another. If you have a table with 100 rows and you union it with another table with 50 rows, your new combined table will have 150 rows. The key is that the tables should share the same (or very similar) column structure.
This is completely different from a join, which combines tables horizontally by adding new columns based on a common field. A union stacks data vertically, increasing the row count, while a join connects data horizontally, increasing the column count.
Here’s a simple comparison:
Imagine you have two simple tables, one for January sales and one for February sales.
January Sales Table:
- Order ID: 101, Product: 'Widget', Sales: $50
- Order ID: 102, Product: 'Gadget', Sales: $75
February Sales Table:
- Order ID: 201, Product: 'Widget', Sales: $60
- Order ID: 202, Product: 'Gizmo', Sales: $90
Performing a union on these two tables would create a single, longer table:
Union Result (4 rows):
- Order ID: 101, Product: 'Widget', Sales: $50
- Order ID: 102, Product: 'Gadget', Sales: $75
- Order ID: 201, Product: 'Widget', Sales: $60
- Order ID: 202, Product: 'Gizmo', Sales: $90
You'd use a union for situations like:
- Combining monthly or quarterly data files into an annual report.
- Merging sales data from different regional offices.
- Aggregating datasets that were separated by year (e.g., ‘sales_2022.csv’, ‘sales_2023.csv’).
Before You Start: Prepping Your Data for a Union
For a union to work smoothly, your data needs to be reasonably consistent across all tables. Taking a moment to check your files first will save you from major headaches later.
Key Requirements for a Successful Union
- Similar Data Structure: The tables you want to union should have the same number of columns that represent the same kind of information.
- Matching Column Names: Tableau automatically matches columns based on their names. If one file has a column named "Revenue" and another calls it "Sales," Tableau will treat them as two separate columns, leading to null values. It's best to standardize these names before starting.
- Consistent Data Types: Ensure that corresponding columns have the same data type. A column for "Date" should be a date in all files, not a mix of date and text fields.
While Tableau has features to help merge mismatched fields after a union, clean data from the start makes the process infinitely easier.
How to Create a Union in Tableau: Step-by-Step
Tableau offers two main ways to create a union: a simple drag-and-drop method and a more powerful wildcard method for joining many files at once. We'll cover both.
Method 1: The Simple Drag-and-Drop Union
This is the most straightforward method for combining a few specific tables or sheets.
- Connect to your data: First, connect to your data source, such as Microsoft Excel, a CSV file, or Google Sheets. This will bring you to the Data Source page in Tableau.
- Drag your first table to the canvas: In the left-hand pane, you'll see the available sheets or tables from your data source. Drag the first one you want to include (e.g., "January Sales") onto the canvas area that says "Drag tables here."
- Drag the second table to union: Now, drag your second table from the left pane and hover it directly below the first table on the canvas. You'll see an orange box appear with the text "Drag table to union."
- Drop the table: Release the mouse button. That’s it! Tableau will combine the two tables, and you'll see the data preview below reflecting the rows from both. You can repeat this process by dragging additional tables onto the unioned table to add them.
The resulting table on your canvas will now be named "Union" and include all the data from the tables you stacked together.
Method 2: Unioning Multiple Files with a Wildcard Search
This method is a lifesaver when you have dozens or even hundreds of files that follow a consistent naming pattern. For example, monthly report files like Sales_2024_01.csv, Sales_2024_02.csv, etc.
- Connect to your data: This process works best with file-based sources like text files (.csv) or Excel spreadsheets stored in a single folder.
- Drag one of the files to the canvas: As before, start by dragging just one of the files you want to union onto the canvas (e.g.,
Sales_2024_01.csv). - Convert to Union: Click the small dropdown arrow on the table name in the canvas and select "Convert to Union."
- Configure the Wildcard search: A new dialog box will pop up. Instead of dragging files manually, you can now define a rule.
- Apply the settings: Click "OK." Tableau will automatically find all matching files and union them together into a single data source. The beauty of this method is that if you add a new file to the folder that matches the pattern (e.g.,
Sales_2024_10.csv), Tableau will automatically include it the next time you refresh your data source.
After the Union: Managing and Cleaning Your New Table
When you create a union, Tableau adds two new columns to your data that can be incredibly useful for analysis: Path and Table Name. These fields help you identify where each row of data originally came from.
- Table Name: This column contains the name of the original table or sheet that the row belongs to (e.g., "January Sales," "February Sales"). You can use this field as a dimension in your worksheets to compare performance across months or regions.
- Path: If unioning files, this shows the full file path. It’s less commonly used for visualization but helpful for data validation.
Handling Mismatched Fields
If you didn't perfectly standardize your column names, you'll see null values in your union. For example, if one table has a "Region" column and another has a "Territory" column, they won't automatically align.
You can fix this directly within the Data Source view:
- In the data grid preview at the bottom, select the two columns you want to combine (hold CTRL or Command and click on the column headers for "Region" and "Territory").
- Right-click on one of the selected column headers.
- Choose "Merge Mismatched Fields."
Tableau will combine them into a single column, filling in the nulls appropriately. The merged column usually takes the name of the first column you selected.
Troubleshooting Common Union Problems
Sometimes things don't go as planned. Here are a few common issues and how to fix them.
Why do I have so many null values?
This is almost always due to mismatched column names or a column that exists in one table but not another. Review the column names in your source files to ensure they match exactly, or use the "Merge Mismatched Fields" option described above to fix it within Tableau.
Why isn’t the Union option appearing?
The "Drag table to union" prompt might not appear if your tables are from different types of data sources (e.g., you can't drag an Excel sheet directly onto an SQL server table to form a union within the canvas). Unions generally need to happen between tables coming from the same connection.
How do I remove a table from a union?
If you dragged a table into a union by mistake, simply right-click the "Union" table on your canvas and select "Edit Union." This will bring up a dialog where you can see all included tables and remove any you don't need.
Final Thoughts
Mastering unions in Tableau is a foundational skill that unlocks the ability to analyze aggregated datasets that would otherwise be frustratingly disconnected. By stacking your data vertically, you can track trends over time, compare performance across categories, and create powerful, all-encompassing dashboards from files that used to live in separate silos.
Although unions are powerful, the process of downloading multiple exports, ensuring naming conventions are perfect, and managing those files can still become a routine chore. At Graphed, we've designed a system to eliminate that manual work entirely. Instead of preparing and unioning files, you can connect your data sources - like Shopify, Google Analytics, or Facebook Ads - just once. From there, you use simple, natural language to ask questions or create dashboards. We handle all the connections and a much more advanced form of data blending in the background, giving you a live, unified view of your business in seconds. If you're looking to spend less time wrangling data and more time acting on it, give Graphed a try.
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?