Article

RELATED and RELATEDTABLE Functions


A-Badde | Posted on April 06, 20

RELATED Function

  Description:

The RELATED function returns a related value from another table.

  Return Value:

RELATED returns a single value that is related to the current row.

  Syntax:

RELATED( <ColumnName> ) 
  • Description of the parameter:

PARAMETER

DESCRIPTION

ColumnName

The column that contains the values you want to retrieve

 

Example:

  In our data model, the Sales table is related to the Geography table. We want to calculate the sales amount for Germany. To do so, we can use the formula down below:

Germany_SalesAmount = 
    SUMX( 
        FILTER(
            Sales,
            RELATED(Geography[RegionCountryName])="Germany"
            )
        ,Sales[SalesAmount]
        )

The RELATED function requires that a relationship exists between the current table and the table with related information. If a relationship does not exist, you must create a relationship.


 

RELATEDTABLE Function

  Description:

The RELATEDTABLE function evaluates a table expression in a context modified by the given filters.

  Return Value:

RELATEDTABLE returns a table of values.

  Syntax:

RELATEDTABLE( <tableName> )  
  • Description of the parameters:

PARAMETER

DESCRIPTION

TableName

The name of an existing table using standard DAX syntax

 

Example:

  We want to add a calculated column to the Product Category table, that calculates the Sales Amount for each Product Category.

  By adding a new column in the table, we can use the following formula:

SalesAmount_Column = 
            SUMX(
                RELATEDTABLE(Sales)
                ,Sales[SalesAmount]
                ) 

 

Related Video:

 

 


(0) Comments

There is no comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Add to favorite
Categories
Recent Posts
DAX Language - CONTAINS Function
A-Badde | May 09, 20

The CONTAINS function returns a boolean value, TRUE if each ...Read More


DAX Language - RANKX Function
A-Badde | May 05, 20

The RANKX function returns a single integer value that repre...Read More


DAX Language - AND and OR Functions
A-Badde | April 10, 20

AND/OR functions check whether all arguments are TRUE or one...Read More


DAX Language - Variables in DAX
A-Badde | April 10, 20

Use Var keyword to store the result of an expression as a na...Read More