01 / 20

Tableau
Relationships

Understand the logical layer in Tableau's data model: how relationships connect tables, preserve granularity, and let you build flexible analyses without writing joins.

Tableau

What Is the Logical Layer?

Starting with version 2020.2, Tableau introduced a two-layer data model. The top layer is the logical layer, where you define relationships between tables. The bottom layer is the physical layer, where traditional joins and unions live.

Why Relationships Matter

★ Preserve Granularity
Each table keeps its own level of detail. No accidental row duplication.
★ Flexible Queries
Tableau generates only the joins needed for the fields in your current viz.
★ No Data Loss
Unmatched rows are not dropped by default: relationships act like context-aware outer joins.

Anatomy of a Relationship

Orders Order ID Customer ID 1001 C-42 1002 C-17 1003 C-42 1004 C-91 Customers Customer ID Name C-17 Alice C-42 Bob C-91 Carol Customer ID = (relationship clause) Logical Table A Logical Table B

Core Rule: Context-Aware Queries

Relationships do not pre-join your data. Instead, Tableau generates the appropriate join at query time based on which fields you drag onto the view.

1
Fields from one table only: Tableau queries that single table. No join happens.
2
Fields from both tables: Tableau generates a join using the relationship clause at the appropriate granularity.
3
Aggregations stay correct: Tableau wraps each table's measures in independent aggregations before combining, preventing duplication.

Query-Time Behavior

Scenario A Orders Customers Only Orders queried SUM(Sales) by Region Scenario B Orders Customers Both tables joined SUM(Sales) by Segment Scenario C: Three Tables Orders Customers Products All three queried as needed AVG(Profit) by Category and Segment Tableau decides the query plan per visualization

Relationships vs. Joins

Relationship Join
Layer Logical (top) Physical (bottom)
When executed Query time (lazy) Data source load (eager)
Granularity Preserved per table Flattened into one result
Unmatched rows Kept (context-aware) Depends on join type
Duplicate risk Low (auto-aggregation) High (manual handling)
Complexity Define clause only Choose type + clause

Logical vs. Physical Layer

Logical Layer (Relationships) Physical Layer Orders (main) Returns (joined) JOIN / UNION inside Physical Layer Customers (single table)

How to Create a Relationship

1
Open the data source pane. Drag your first table onto the canvas. It becomes the root logical table.
2
Drag a second table next to the first. A noodle (relationship line) appears automatically.
3
Define the matching clause. Tableau auto-detects matching field names. Verify or change the field pair.
4
Set performance options (optional). You can specify cardinality (many-to-one, etc.) and referential integrity to help Tableau optimize queries.
5
Start building your viz. Tableau handles the rest: choosing join type, aggregation, and filtering context at query time.

Performance Options: Cardinality

Cardinality describes how many rows in one table match a single row in the other. Tableau uses this hint to optimize queries.

Many-to-One
Most common. Many orders per customer. Tableau can avoid unnecessary aggregation wrapping.
One-to-One
One row matches exactly one row. E.g., employee to badge number. Simplest join plan.
Many-to-Many
Both sides can have duplicates. Requires the most careful aggregation. Tableau handles it, but queries are heavier.

Referential Integrity

Referential integrity tells Tableau whether every value in the matching field on one side has a corresponding value on the other side.

Some records match
Default. Tableau uses outer joins to keep unmatched rows. Safest option.
All records match
Tableau can use inner joins, producing faster queries. Only set this when you are certain no orphan rows exist.

Example 1: Two Tables

Orders Order ID Product ID Sales Quantity Products Product ID Category Sub-Category Product Name Product ID

Example 2: Star Schema

Orders (Fact Table) Products Customers Regions Dates

Example 3: Multi-Fact Model

Orders Sales, Profit Products Category, Name Returns Return Reason Product ID Product ID Two fact tables share a dimension through Products

Common Mistakes

✕ Using Joins When Relationships Work
Dropping into the physical layer unnecessarily. This flattens your data and risks duplication.
✕ Wrong Matching Clause
Accepting the auto-detected field without checking. If two fields share a name but have different meanings, the relationship produces wrong results.
✕ Forcing "All Records Match"
Claiming referential integrity when orphan rows exist. This silently drops data from your viz.

Summary Comparison

Relationship Join Blend
Defined in Logical layer Physical layer Worksheet
Scope Entire data source Within one logical table Single sheet only
Aggregation Auto-independent You manage it Primary + secondary
Null handling Context-aware outer By join type Outer by default
Best for Most use cases Row-level matching Cross-source linking

Question 1 of 5

What layer of Tableau's data model do relationships belong to?

Question 2 of 5

When you build a viz using fields from only one table in a multi-table relationship model, what happens?

Question 3 of 5

What is the primary risk of incorrectly setting referential integrity to "All records match" when orphan rows exist?

Question 4 of 5

In a star schema with one fact table and three dimension tables, how many relationships do you define in the logical layer?

Question 5 of 5

How do relationships prevent measure duplication when two tables have different granularity?