Bird
Raised Fist0
Tableaubi_tool~10 mins

Union and join basics in Tableau - Cell-by-Cell Formula Trace

Choose your learning style10 modes available
Sample Data

Two tables for union (left and right) with customer info, and one table for join with sales data.

CellValue
A1ID
B1Name
C1City
A21
B2Alice
C2New York
A32
B3Bob
C3Chicago
A43
B4Charlie
C4Seattle
E1ID
F1Name
G1City
E24
F2Diana
G2Boston
E35
F3Evan
G3Denver
E46
F4Fiona
G4Austin
I1ID
J1Name
K1City
L1Sales
I21
J2Alice
K2New York
L2100
I32
J3Bob
K3Chicago
L3150
I47
J4George
K4Miami
L4200
Formula Trace
UNION(Table1, Table2) and LEFT JOIN UNION(Table1, Table2) with SalesTable on ID
Step 1: UNION(Table1, Table2)
Step 2: LEFT JOIN (Result of UNION) with SalesTable on ID
Cell Reference Map
  A      B       C       E      F       G       I      J       K       L
+-----+-------+-------+-----+-------+-------+-----+-------+-------+-------+
| ID  | Name  | City  | ID  | Name  | City  | ID  | Name  | City  | Sales |
|  1  | Alice | New York |  4  | Diana | Boston|  1  | Alice | New York |  100  |
|  2  | Bob   | Chicago |  5  | Evan  | Denver|  2  | Bob   | Chicago |  150  |
|  3  | Charlie| Seattle | 6  | Fiona | Austin|  7  | George| Miami |  200  |
+-----+-------+-------+-----+-------+-------+-----+-------+-------+-------+
  ^       ^       ^       ^       ^       ^       ^       ^       ^       ^
  |       |       |       |       |       |       |       |       |       |
  +-------+-------+-------+-------+-------+-------+-------+-------+-------+
References: Table1 (A1:C4), Table2 (E1:G4), SalesTable (I1:L4)
Shows the three tables with their columns and rows. Arrows indicate these cells are referenced in union and join operations.
Result
  M      N       O       P
+-----+-------+-------+-------+
| ID  | Name  | City  | Sales |
|  1  | Alice | New York |  100  |
|  2  | Bob   | Chicago | 150  |
|  3  | Charlie | Seattle | null |
|  4  | Diana | Boston | null  |
|  5  | Evan  | Denver | null  |
|  6  | Fiona | Austin | null  |
+-----+-------+-------+-------+
Final table after union and left join. All customers from both tables appear with sales data where available; missing sales show null.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the UNION operation do with the two tables?
AStacks all rows from both tables vertically, keeping all columns
BMatches rows by ID and combines columns side by side
CKeeps only rows that appear in both tables
DRemoves duplicate rows and columns
Key Result
UNION stacks rows vertically from two tables; LEFT JOIN adds columns from another table matching on key, keeping all left rows.

Practice

(1/5)
1. Which of the following best describes a Union in Tableau?
easy
A. It filters data based on a condition.
B. It combines columns from two tables based on matching keys.
C. It creates a new calculated field.
D. It stacks rows from two or more tables with similar columns.

Solution

  1. Step 1: Understand Union purpose

    A Union stacks rows from tables that have the same columns, combining data vertically.
  2. Step 2: Compare with Join

    Join combines columns horizontally based on matching keys, not stacking rows.
  3. Final Answer:

    It stacks rows from two or more tables with similar columns. -> Option D
  4. Quick Check:

    Union = stacking rows [OK]
Hint: Union stacks rows; Join combines columns [OK]
Common Mistakes:
  • Confusing Union with Join
  • Thinking Union combines columns
  • Assuming Union filters data
2. Which syntax correctly represents a Join in Tableau's data source page?
easy
A. Drag one table onto another and select the join type.
B. Use the UNION keyword in the data pane.
C. Create a calculated field with JOIN() function.
D. Right-click a table and select 'Append'.

Solution

  1. Step 1: Identify Join method in Tableau

    In Tableau, you join tables by dragging one table onto another and choosing the join type (Inner, Left, Right, Full).
  2. Step 2: Eliminate incorrect options

    Union keyword is for unions, JOIN() function does not exist, and 'Append' is not a Tableau option.
  3. Final Answer:

    Drag one table onto another and select the join type. -> Option A
  4. Quick Check:

    Join = drag tables + select join [OK]
Hint: Join by dragging tables together in Tableau [OK]
Common Mistakes:
  • Confusing Union keyword with Join
  • Looking for JOIN() function which doesn't exist
  • Using 'Append' instead of Union or Join
3. Given two tables:
Table A: ID, Name
Table B: ID, Sales
What will be the result of an Inner Join on ID?
medium
A. A table with only IDs from Table A and no Sales column.
B. A table stacking all rows from both tables vertically.
C. A table with columns ID, Name, Sales containing only matching IDs.
D. A table with all IDs from both tables, including unmatched rows.

Solution

  1. Step 1: Understand Inner Join behavior

    Inner Join returns rows where the join key (ID) exists in both tables, combining columns.
  2. Step 2: Analyze columns and rows

    The result will have columns ID, Name, Sales and only rows with matching IDs in both tables.
  3. Final Answer:

    A table with columns ID, Name, Sales containing only matching IDs. -> Option C
  4. Quick Check:

    Inner Join = matching rows + combined columns [OK]
Hint: Inner Join keeps only matching keys with all columns [OK]
Common Mistakes:
  • Thinking Inner Join stacks rows
  • Expecting unmatched rows included
  • Confusing columns included in result
4. You tried to Union two tables but got an error. What is the most likely cause?
medium
A. You forgot to select a join type.
B. The tables have different column names or data types.
C. You used a calculated field instead of a table.
D. You dragged tables instead of using the Union option.

Solution

  1. Step 1: Identify Union requirements

    Union requires tables to have matching column names and compatible data types to stack rows.
  2. Step 2: Understand error cause

    If columns differ in name or type, Tableau cannot stack rows, causing an error.
  3. Final Answer:

    The tables have different column names or data types. -> Option B
  4. Quick Check:

    Union error = mismatched columns/types [OK]
Hint: Union needs matching columns and types [OK]
Common Mistakes:
  • Confusing Union errors with Join errors
  • Not checking column names and types
  • Trying to drag tables instead of using Union
5. You have monthly sales data split into two tables: Sales_Jan and Sales_Feb with identical columns. You also have a Customers table with customer details. How do you create a combined dataset showing all sales with customer info?
hard
A. Union Sales_Jan and Sales_Feb, then Join the result with Customers on CustomerID.
B. Join Sales_Jan with Customers, then Union with Sales_Feb.
C. Union Customers with Sales_Jan and Sales_Feb directly.
D. Join Sales_Jan and Sales_Feb on CustomerID, then Union with Customers.

Solution

  1. Step 1: Combine monthly sales data vertically

    Since Sales_Jan and Sales_Feb have identical columns, use Union to stack their rows into one sales table.
  2. Step 2: Enrich sales data with customer info

    Join the combined sales table with Customers on CustomerID to add customer details horizontally.
  3. Final Answer:

    Union Sales_Jan and Sales_Feb, then Join the result with Customers on CustomerID. -> Option A
  4. Quick Check:

    Union sales first, then Join customers [OK]
Hint: Union similar tables first, then Join related tables [OK]
Common Mistakes:
  • Joining before unioning sales tables
  • Trying to union unrelated tables
  • Joining sales tables instead of unioning
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard