RELATED() & RELATEDTABLE()

Learn how RELATED and RELATEDTABLE pull values across relationships in a Power BI data model.

RELATED() & RELATEDTABLE()

RELATED() and RELATEDTABLE() pull data across an existing relationship, without needing a manual lookup or merge.

They only work where a relationship already connects the two tables — neither function creates a relationship, they just read across one that's already there.


RELATED() returns a single related value from the "one" side of a relationship, evaluated from the "many" side.

RELATED(Column)

Example — pulling a product's category onto each sales row:

Category =
RELATED(DimProduct[Category])
DimProduct (one)          FactSales (many)
ProductKey | Category      ProductKey | ...
1001       | Bikes         1001       | ...
                            1001       | ...   <- Category = "Bikes" via RELATED()

RELATED() only works in the direction from many to one — it can't be used on a fact table's column to pull a value across to a dimension table, since a single dimension row can relate to many fact rows, not one.

Anatomy of RELATED()

Category = RELATED(DimProduct[Category])

DimProduct (one side)

ProductKeyCategory
10011Bikes
10021Accessories
relationship: one ProductKey → many ProductKey

FactSales (many side)

OrderIDProductKeyCategory (RELATED)
500110012Bikes✓
50021002Accessories
50031001Bikes
50041001Bikes
1

ProductKey on the one side — each value appears at most once in DimProduct.

2

ProductKey on the many side — the same value can repeat across several FactSales rows. RELATED() finds the one matching row on the other side of the relationship, for every row here independently.

✓

Category — pulled across for every row on the many side, not just the first. Three different FactSales rows share ProductKey 1001, and all three independently resolve to "Bikes".


RELATEDTABLE(): Pulling Multiple Rows

RELATEDTABLE() is the reverse: from the "one" side, it returns every related row from the "many" side, as a table.

RELATEDTABLE(Table)

Example — counting how many orders a customer has placed:

Order Count =
COUNTROWS(RELATEDTABLE(FactSales))
DimCustomer (one)                FactSales (many)
CustomerKey | ...                 CustomerKey | OrderID
1                                  1           | 5001
                                   1           | 5002
                                   1           | 5003
        RELATEDTABLE returns all 3 rows for CustomerKey 1

Because it returns a table, RELATEDTABLE() is almost always wrapped in an aggregation function — COUNTROWS(), SUMX(), AVERAGEX() — rather than used on its own.


DirectionReturnsTypical Use
RELATED()Many-to-oneA single valuePulling a dimension attribute onto a fact row
RELATEDTABLE()One-to-manyA tableCounting or aggregating related fact rows from a dimension row

RELATED() is most commonly used in a calculated column, to flatten a dimension attribute directly onto the fact table.

Product Category =
RELATED(DimProduct[Category])

This is useful when a visual or another calculation needs the category available directly on FactSales, rather than requiring a relationship lookup at query time.


RELATEDTABLE Needs a Current Row

Like RELATED(), RELATEDTABLE() works from a current row: in a calculated column, or inside an iterator. In a measure, use it inside an iterator over the "one" side:

Customers With 3+ Orders =
COUNTROWS(
    FILTER(
        DimCustomer,
        COUNTROWS(RELATEDTABLE(FactSales)) >= 3
    )
)

FILTER walks the customers, and for each one RELATEDTABLE(FactSales) returns that customer's sales.


Requires an Existing Relationship

Both functions need an active relationship (or a chain of them) connecting the two tables.

DimProduct           FactSales
    |                     |
    +----- relationship --+
             |
    RELATED() / RELATEDTABLE() can now cross it

If there's no active relationship to follow, the formula fails with an error saying the column doesn't have a relationship to any table available in the current context. When the relationship exists but a fact row's key has no match on the other side, RELATED() returns blank for that row. See USERELATIONSHIP for working with inactive relationships.

Try it live — pick a customer, then break the relationship

FactSales[CustomerKey]OrderID
15001
15002
15003
25004
Viewing DimCustomer row
Order Count = COUNTROWS(RELATEDTABLE(FactSales))

Evaluated for CustomerKey 1, 3 matching rows in FactSales

3

— with the relationship active, RELATEDTABLE() correctly finds every FactSales row for CustomerKey 1. Turn off the relationship above to see what happens instead.


Common Mistakes

RELATED() follows a whole chain of many-to-one relationships. From FactSales, RELATED(DimCategory[CategoryName]) works when FactSales relates to DimProduct and DimProduct relates to DimCategory. There's no need for an intermediate calculated column on DimProduct.

Forgetting RELATEDTABLE Returns a Table

Using RELATEDTABLE() directly where a single value is expected produces an error — it needs to be wrapped in COUNTROWS(), SUMX(), or another aggregation.

RELATED() only pulls from one to many. Trying to use it from a dimension table to reach a fact table's column returns an error, since a dimension row doesn't correspond to a single fact row — that's what RELATEDTABLE() is for.


Best Practices

  • Use RELATED() in calculated columns when a dimension attribute genuinely needs to live directly on the fact table, not as a substitute for a working relationship.
  • Wrap RELATEDTABLE() in an aggregation function; it's a table function, not a scalar one.
  • Confirm the relationship is active before relying on either function — without an active relationship, the formula errors.
  • Prefer a direct relationship and native filter propagation over RELATED()/RELATEDTABLE() when the same result can be achieved without a calculated column.

Next Steps

Continue learning DAX functions:

See it applied end to end: Build a Reliability (MTBF/MTTR) Dashboard uses RELATED to pull an asset's commissioning date into a calculated column.