RELATED
A column's value from the table on the one side of a relationship, for the current row.
Group: Relationships. Compatible with DAX.
Syntax
RELATED ( <column> )
| Parameter | Type | Description |
|---|---|---|
column | Column | A column of a table on the one side of a relationship from the current row's table. |
Returns
Same type as the column. The column's value in the row that the current row belongs to.
Remarks
- It needs a row context: an iterator such as
SUMXorFILTER,ADDCOLUMNS, or a calculated column. In a measure on its own it is an error. - It goes from the many side of a relationship to the one side. In the other direction there are several rows to choose from: use
RELATEDTABLE. - A row whose key the other table lacks gets a blank.
- Through an inactive relationship it works when
USERELATIONSHIPmakes it the active one, in aCALCULATEaround the iteration.
Examples
Columns from two related tables
Each Oslo production row picks up its product's price and its plant's bottling hours.
EVALUATE
ADDCOLUMNS (
FILTER ( Production, Production[Plant] = "Oslo" ),
"Price per liter", RELATED ( Products[Price per liter] ),
"Bottling hours", RELATED ( Plants[Bottling hours] )
)
ORDER BY Production[Product]
| Production[Product] | Production[Plant] | Production[Margin per liter] | Production[Hours per liter] | Price per liter | Bottling hours |
|---|---|---|---|---|---|
| Cider | Oslo | 15 | 0.014 | 52 | 2000 |
| IPA | Oslo | 19.5 | 0.018 | 64 | 2000 |
| Lettøl | Oslo | 7.5 | 0.01 | 30 | 2000 |
| Pils | Oslo | 11 | 0.012 | 38 | 2000 |
Filtering rows by a related column
EVALUATE
ROW (
"Liters sold in shops", SUMX ( FILTER ( Sales, RELATED ( Places[Kind] ) = "Shop" ), Sales[Liters] ),
"Beer in Frogner",
SUMX (
FILTER ( Sales, RELATED ( Places[District] ) = "Frogner" && RELATED ( Products[Category] ) = "Beer" ),
Sales[Liters]
)
)
| Liters sold in shops | Beer in Frogner |
|---|---|
| 1806463 | 148541 |