All DAX Functions

The RELATED() Function: Fetching Values Across Relationships

Look up dimension values from the one side of a relationship.

On this page

Overview

The RELATED function retrieves a value from another table along an active many-to-one relationship. It can only be used in a row context—typically inside calculated columns or iterator functions like SUMX—not in simple measures that lack row context.

Think of it as a lookup: for each row in the current table, RELATED follows the relationship to fetch a single matching value from the related table on the "one" side.

Syntax

DAX Syntax
RELATED(<column>)
  • <column>: A column from the related table on the "one" side of an active many-to-one relationship.
  • Must be called in row context (calculated column, SUMX, FILTER, etc.).

Example & Dataset

A star schema with a Sales fact table (many rows per product) linked to a Products dimension (one row per product):

Products (Dimension)

ProductIDProductNameCostPerUnit
P01Laptop600
P02Mouse8

Sales (Fact)

SaleIDProductIDRevenue
S01P01900
S02P01850
S03P0225
S04P0230

The DAX Code

To compute total profit margin across all sales lines, use SUMX with RELATED to pull each product's cost per unit into the row context of Sales:

Total Profit Margin Measure
Total Profit Margin =
SUMX(
    Sales,
    Sales[Revenue] - ( RELATED(Products[CostPerUnit]) * 1 )
)

Expected Output Visual

A Card visual showing [Total Profit Margin] displays:

Output

SaleIDRevenueCost (via RELATED)Line ProfitRunning Total
S01900600300
S02850600250
S0325817
S0430822
Total Profit Margin589

Why Did This Output Happen?

SUMX creates row context on Sales. For each sale row, RELATED(Products[CostPerUnit]) follows the ProductID relationship and returns the matching cost from Products. Line profit is Revenue minus CostPerUnit (quantity assumed 1 per row). Summing 300 + 250 + 17 + 22 = 589 gives total profit margin across all transactions.