0
0
Power-biHow-ToBeginner ยท 3 min read

How to Use RELATED in DAX in Power BI: Simple Guide

In Power BI, use the RELATED function in DAX to fetch a value from a related table based on an existing relationship. It works like a lookup that pulls a single matching value from another table connected by a relationship.
๐Ÿ“

Syntax

The RELATED function syntax is simple:

  • RELATED(ColumnName): Returns the value of ColumnName from a related table.

This function requires a relationship between the current table and the related table. It returns a single value for each row.

DAX
RELATED(<ColumnName>)
๐Ÿ’ป

Example

This example shows how to use RELATED to get the product category name from the Products table into the Sales table.

Assume there is a relationship between Sales[ProductID] and Products[ProductID].

DAX
CategoryName = RELATED(Products[CategoryName])
Output
For each row in Sales, CategoryName will show the matching product's category name from Products.
โš ๏ธ

Common Pitfalls

  • No relationship: RELATED fails if there is no relationship between tables.
  • Many-to-many relationships: RELATED expects a one-to-many or many-to-one relationship, not many-to-many.
  • Multiple matches: If multiple rows match, RELATED returns an error because it expects a single value.

Always check your model relationships before using RELATED.

DAX
/* Wrong: No relationship exists */
CategoryName = RELATED(Products[CategoryName])

/* Right: Ensure relationship exists between Sales and Products tables */
๐Ÿ“Š

Quick Reference

RELATED function quick tips:

  • Use to fetch a single value from a related table.
  • Requires an existing relationship in the data model.
  • Works only in calculated columns where row context exists.
  • Returns an error if multiple related rows exist.
โœ…

Key Takeaways

RELATED fetches a single value from a related table using existing relationships.
Ensure a one-to-many or many-to-one relationship exists before using RELATED.
RELATED returns errors if no relationship or multiple matches exist.
Use RELATED in calculated columns or measures with row context.
It works like a lookup to bring related data into your current table.