Article

RELATED and RELATEDTABLE Functions

RELATED and RELATEDTABLE Functions


A.Baddane | Posted on April 06, 21

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
Add to favorite
Categories
Recent Posts
Filter column based on a list in Power Query
A.Baddane | April 05, 23

Sometimes when you work within power query, you need to filt...Read More


Use HTML in Power BI - Part 2
A.Baddane | July 05, 22

In the first blog post about using HTML in Power BI Desktop,...Read More


Use HTML in Power BI
A.Baddane | Feb. 21, 22

In this blog post, I will show you how to use HTML to create...Read More


Covid-19 Report
A.Baddane | Nov. 23, 21

The COVID-19 pandemic, also known as the coronavirus pandemi...Read More