01 / 20

Unions in
Tableau

Learn how to append rows from multiple tables, validate schema alignment, and build clean, unified datasets for analysis.

Tableau

What Is a Union?

A union is a data operation that stacks rows from two or more tables on top of each other into a single, combined table. Think of it like stacking pages of a spreadsheet: each page has the same columns, and you put all the rows together.

How a Union Stacks Data

Table A (Q1 Sales) Name Region Revenue Alice East 5000 Bob West 7200 Table B (Q2 Sales) Name Region Revenue Carol East 6100 Dave North 4300 UNION Result (Combined) Name Region Revenue Alice East 5000 Bob West 7200 Carol East 6100 Dave North 4300 4 rows total (2 + 2) Same 3 columns preserved

Why Do Unions Matter?

Combine Periods
Stack monthly or quarterly files into a single timeline for trend analysis.
Merge Regions
Append identical sheets from different regions into one master dataset.
Grow Datasets
Add new records as data arrives without restructuring existing work.

In real-world analytics, data often arrives in separate files or sheets with the same structure. Unions let you treat them as a single source of truth without manually copying and pasting rows.

The Union Rule

Table A Schema Col 1 Col 2 Col 3 Table B Schema Col 1 Col 2 Col 3 ✓ ✓ ✓ Schema Aligned ✓ Same column names Same data types Same semantic meaning → Safe to union

What Is Schema Alignment?

1
Column names must match. "Revenue" in Table A must be "Revenue" in Table B: not "Sales" or "revenue".
2
Data types must be compatible. A "Date" column in one table cannot become a "String" in another.
3
Column order matters less in Tableau (it matches by name), but keeping a consistent order prevents confusion.
4
Extra columns create nulls. If Table B has a column Table A lacks, Tableau adds the column and fills it with null for Table A's rows.

Union vs Join

Union Join
Direction Vertical (stacks rows) Horizontal (adds columns)
Requirement Same column structure Shared key field
Result rows Sum of all source rows Depends on join type
Result columns Same as sources Combined from both tables
Use case Append time periods, regions Enrich data with lookups

How to Create a Union

1
Connect to your data source. Open Tableau and connect to the file or database containing your tables.
2
Drag the first table into the canvas area. This becomes the base of your union.
3
Drag the second table below it until you see the "Drag table to union" prompt, then release.
4
Validate schema alignment. Check that columns are matched correctly: look for orange warning icons on mismatched fields.
5
Rename or merge any mismatched columns manually if Tableau cannot auto-match them.

Wildcard Unions

When you have many identically structured files (e.g., Sales_Jan.csv, Sales_Feb.csv, Sales_Mar.csv), manually dragging each one is tedious. Tableau's wildcard union automates this.

Pattern Matching
Use Sales_*.csv to match all files starting with "Sales_" in the folder.
Auto-Append
New files added to the folder are automatically included on refresh.

Example 1: Basic Union

You have two sheets in one Excel workbook: Q1_Orders and Q2_Orders. Both have columns: OrderID, Customer, Amount.

Q1_Orders OrderID Customer Amount 101 Acme $250 102 Globex $430 Q2_Orders OrderID Customer Amount 201 Acme $310 202 Wayne $580 Unioned Result OrderID Customer Amount Sheet 101 Acme $250 Q1_Orders 102 Globex $430 Q1_Orders 201 Acme $310 Q2_Orders 202 Wayne $580 Q2_Orders 4 rows, 4 columns (Sheet auto-added)

Example 2: Mismatched Columns

Table A has columns Name, Region, Revenue. Table B has Name, Region, Revenue, Discount. What happens?

Table A (3 cols) Name Region Revenue Table B (4 cols) Name Region Revenue Discount Unioned Result Name Region Revenue Discount Alice East 5000 null Carol East 6100 10% Table A rows get null for Discount

Example 3: Data Type Mismatch

Table A has a column ZipCode stored as a Number. Table B has the same column stored as a String. When you union them, Tableau must pick one type.

Table A
ZipCode: Number
Example: 90210
Table B
ZipCode: String
Example: "02134"

Validating Schema Alignment

1
Check column count. After union, the result should have the expected number of columns. Extra columns suggest a naming mismatch.
2
Look for null patterns. If an entire column is null for half the rows, it likely means two columns with different names hold the same data.
3
Merge mismatched columns. In the Data Source tab, right-click a column and select "Merge Mismatched Fields" to combine columns Tableau couldn't auto-match.
4
Verify data types. Click on each column header icon: Abc = String, # = Number, calendar = Date. Fix any incorrect types immediately.

Auto-Generated Columns

When you create a union, Tableau automatically adds metadata columns to help you trace data origins:

Sheet
The name of the sheet or table each row came from.
Table Name
The full file path or table name (useful for wildcard unions with many files).

Common Mistakes

✕ Using Union Instead of Join
Trying to combine tables with different structures (e.g., orders + customers) when you need a join, not a union.
✕ Ignoring Column Name Typos
"Revenue" vs "Reveune": Tableau treats them as different columns, creating two columns with nulls instead of one merged column.
✕ Skipping Type Validation
Not checking if a number column was read as string in one table, leading to broken calculations downstream.

Union Quick Reference

Concept Details
Direction Vertical: stacks rows
Schema requirement Matching column names + types
Extra columns Filled with null for missing sources
Auto-generated fields Sheet, Table Name
Wildcard unions Pattern-match files (e.g., Sales_*.csv)
Validation steps Check column count, nulls, data types
Union vs Join Union = more rows; Join = more columns

Question 1 of 5

What does a union operation do in Tableau?

Question 2 of 5

Table A has columns Name, Region, Revenue. Table B has columns Name, Region, Revenue, Tax. What happens to the Tax column when you union them?

Question 3 of 5

You have 12 monthly CSV files with identical structures. Which Tableau feature is the most efficient way to union them?

Question 4 of 5

After creating a union, you notice that your result has two separate columns: "Revenue" and "Reveune", each half-filled with nulls. What most likely happened?

Question 5 of 5

Which auto-generated column does Tableau add to a union so you can identify the source of each row?