0
0
Tableaubi_tool~10 mins

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

Choose your learning style9 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.