Редагувати

Поділитися через


RELATEDTABLE

Applies to: Calculated column Calculated table Measure Visual calculation

Evaluates a table expression in a context modified by the given filters.

Syntax

RELATEDTABLE(<tableName>)  

Parameters

Term Definition
tableName The name of an existing table using standard DAX syntax. It cannot be an expression.

Return value

A table of values.

Remarks

  • The RELATEDTABLE function changes the context in which the data is filtered, and evaluates the expression in the new context that you specify.

  • This function is a shortcut for CALCULATETABLE function with no logical expression.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example

The following example uses the RELATEDTABLE function to create a calculated column with the Internet Sales in the Product Category table:

= SUMX( RELATEDTABLE('InternetSales_USD')  
     , [SalesAmount_USD])  

The following table shows the results:

Product Category Key Product Category AlternateKey Product Category Name Internet Sales
1 1 Bikes $28,318,144.65
2 2 Components
3 3 Clothing $339,772.61
4 4 Accessories $700,759.96

CALCULATETABLE
Filter functions