Relationship
Returns a related value from another table
RELATED(<column>)
Comprehensive Guide to the RELATED DAX Function
Overview
The RELATED function is one of the most essential DAX functions for working with relational data models in Power BI. It allows you to retrieve values from a related table by traversing relationships in the data model. This function is crucial for bringing dimension attributes into fact tables, creating calculated columns that reference other tables, and building complex business logic.
Applies to: Calculated columns, Calculated tables (in row context)
Does NOT work in: Measures (unless used within row context functions like SUMX, FILTER)
Syntax
RELATED ( <column> )Parameters
Parameter | Required | Description | Example |
column | Yes | A column from a related table that you want to retrieve | DimProduct[Product Name], DimCustomer[City] |
Return Value
Returns a single value from the specified column in the related table for the current row context.
Understanding How RELATED Works
The Relationship Direction Concept
RELATED works by following existing relationships in your data model. It's critical to understand the direction:
RELATED travels from the MANY side → to the ONE side
Example:
FactSales (Many) ──────→ DimProduct (One)
ProductKey ProductKey
In FactSales, you can use RELATED to get DimProduct columnsVisual Representation:
FactSales Table (Many Side *) DimProduct Table (One Side 1)
┌──────────────────────┐ ┌──────────────────────┐
│ SalesKey [PK]│ │ ProductKey [PK] │
│ ProductKey [FK]│ ──────────> │ Product Name │
│ Quantity │ │ Category │
│ Sales Amount │ │ List Price │
└──────────────────────┘ │ Color │
└──────────────────────┘
RELATED works here ✅
Can get: RELATED(DimProduct[Product Name])RELATED vs RELATEDTABLE
The Golden Rule of RELATED vs RELATEDTABLE
RELATED (Many → One)
Used in: Fact Tables (Many side)
Direction: From MANY rows → to ONE row
Returns: Single value
Purpose: Get dimension attributes into fact table
Function | Direction | Returns | Use Case |
RELATED | Many → One | Single value | Get dimension attribute into fact table |
RELATEDTABLE | One → Many | Table of rows | Get all related fact rows into dimension |
Basic Examples Using Contoso Data
Example 1: Get Product Name in Sales Table
Example 2: Get Customer City in Sales Table
Example 3: Get Category from Product Table
Multi-Level Relationships (Chained RELATED)
You can chain RELATED through multiple tables by following multiple relationships.