Unions in
Tableau
Learn how to append rows from multiple tables, validate schema alignment, and build clean, unified datasets for analysis.
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
Why Do Unions Matter?
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
What Is Schema Alignment?
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
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.
Example 1: Basic Union
You have two sheets in one Excel workbook: Q1_Orders and Q2_Orders. Both have columns: OrderID, Customer, Amount.
Example 2: Mismatched Columns
Table A has columns Name, Region, Revenue. Table B has Name, Region, Revenue, Discount. What happens?
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.
Example: 90210
Example: "02134"
Validating Schema Alignment
Auto-Generated Columns
When you create a union, Tableau automatically adds metadata columns to help you trace data origins:
Common Mistakes
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?