pbPassingBI
/
Connecting & structuring data intermediate 7 min

Relationships and unions

The relationship model, when to use it over a join, and stacking tables.

What you'll be able to do
  • Explain how relationships differ from joins
  • Choose between relationship, join and blend
  • Union tables and files

What a relationship is

Introduced in 2020.2, a relationship is a defined link between tables that Tableau resolves at query time based on what is in the view.

Unlike a join, no rows are combined up front. Each table keeps its own granularity, and Tableau works out the appropriate join and aggregation for each visualisation.

Why this matters

The classic problem a relationship solves is the fan-out. Join orders to line items and every order total is duplicated per line. With a relationship, a view showing only order totals queries only the orders table — so the total is correct.

Relationship, join or blend

SituationUse
Tables in one source, different granularityRelationship
Tables in one source, same granularity, want row-level controlJoin
Different sources that cannot be joinedBlend

Relationships are the default for new data sources and should be the starting point. Drop to a join when you specifically need a fixed row-level result — a filtered inner join, or an explicit duplicate.

Unions

A union stacks tables vertically — twelve monthly sheets into one table. Drag a table beneath another in the canvas, or use New Union.

Fields are matched by name. Mismatched fields appear with nulls and can be merged manually where the same thing is named differently in different files.

Tableau adds Table Name and Path fields recording where each row came from. Keep them at least until you have verified the union.

Wildcard union

In the union dialog, the Wildcard tab matches files by pattern — sales_*.csv in a folder, with an option to include subfolders.

New files matching the pattern are picked up on refresh with no edit to the workbook. Without it, someone opens the workbook every month to add the new file.

Key points
  • A relationship resolves the join at query time, preventing fan-out
  • Relationships suit differing granularity; joins give fixed row-level control
  • A wildcard union picks up new files automatically on refresh
Check yourself