OpenBI Docs Buy

RELATEDTABLE

The rows of a related table that belong to the current row.

Group: Relationships. Compatible with DAX.

Syntax

RELATEDTABLE ( <tableName> )
ParameterTypeDescription
tableNameTableA table on the many side of a relationship from the current row's table.

Returns

Table. The rows of that table that belong to the current row.

Remarks

  • In a row context it gives the rows that belong to the current row: for a product, its rows of Sales.
  • It works as CALCULATETABLE ( table ): the current row becomes a filter (context transition), which reaches the table through the relationships.
  • Without a row context, it gives the table's rows in the current filter context.
  • A row with no related rows gets an empty table; COUNTROWS of it is BLANK.
  • A table the current row's table does not reach is not narrowed at all: from a product, RELATEDTABLE ( Places ) is every place, as the relationships filter from Places and Products to Sales.

Examples

Rows of two related tables, per product

EVALUATE
ADDCOLUMNS (
    Products,
    "Sales rows", COUNTROWS ( RELATEDTABLE ( Sales ) ),
    "Liters", SUMX ( RELATEDTABLE ( Sales ), Sales[Liters] ),
    "Plants", COUNTROWS ( RELATEDTABLE ( Production ) )
)
ORDER BY Products[Product]
Products[Product]Products[Category]Products[Price per liter]Sales rowsLitersPlants
CiderCider525403010743
IPABeer645403318843
LettølBeer305401691793
PilsBeer3854010043263

A place without sales

The depot has no rows in Sales: its count and its liters are blank.

EVALUATE
SELECTCOLUMNS (
    FILTER ( Places, Places[District] = "Alnabru" || Places[District] = "Frogner" || Places[District] = "Storo" ),
    "Place", Places[Place],
    "Sales rows", COUNTROWS ( RELATEDTABLE ( Sales ) ),
    "Liters", SUMX ( RELATEDTABLE ( Sales ), Sales[Liters] )
)
ORDER BY [Place]
PlaceSales rowsLiters
Depot Alnabru(blank)(blank)
Shop Frogner144151920
Shop Storo144133794

RELATED, CALCULATETABLE, COUNTROWS, SUMX, FILTER.

Last updated · OpenBI Studio 0.3.74