OpenBI Docs Buy

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> )
ParameterTypeDescription
columnColumnA 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 SUMX or FILTER, 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 USERELATIONSHIP makes it the active one, in a CALCULATE around 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 literBottling hours
CiderOslo150.014522000
IPAOslo19.50.018642000
LettølOslo7.50.01302000
PilsOslo110.012382000

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 shopsBeer in Frogner
1806463148541

RELATEDTABLE, LOOKUPVALUE, SUMX, FILTER, USERELATIONSHIP.

Last updated · OpenBI Studio 0.3.74