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.
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
Anatomy of a Relationship
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.
Query-Time Behavior
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
How to Create a Relationship
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.
Referential Integrity
Referential integrity tells Tableau whether every value in the matching field on one side has a corresponding value on the other side.
Example 1: Two Tables
Example 2: Star Schema
Example 3: Multi-Fact Model
Common Mistakes
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?