Home » DAX » RELATED DAX Function

RELATED DAX Function

Related Dax Relationship

The Related Function is a DAX function in Power BI that allows you to retrieve related values from a related table in the Data Model.

It is used to establish a relationship between tables based on a common column, and then retrieve related data from one table to another. It comes under Relationship functions category.

Refer similar post – RELATEDTABLE

Syntax

RELATED(<Column name>)

Sample Data set

Product Table

Id Product Name Price
1 Ring 100
2 Box 150
3 Bag 200

Sales Table

ID Quantity Product Id
1 2 1
2 3 2
3 1 2
4 5 1
5 6 3




Understand the Requirement-

How can we get Price, Product Name & Total Sales Amount  data from Product table to Sales table?

Let’s get started-

Step-1: RELATED function only works if a relationship has been established between the tables, let’s create a relationship between both tables.

Click on data tab > and make relationship based on Product Id & ID column in both tables.

Note: Support only One-to-one & One- to-Many relationship.

Related Dax Relationship

Related Dax Relationship

Once the relationship is established, you can use the RELATED function to retrieve information from the Product table and display it in the Sales table.

Now create few  New column to Sales table and write below DAX-

Product Price = RELATED('Product'[Price])
Product Name = RELATED('Product'[Product Name])
Total Amount = Sales[Quantity]* RELATED('Product'[Price])

Above formula retrieves the Product Name, Price column from the Product table, based on the established relationship between the Sales table and the Product table.

Related DAX output

Related DAX output

Refer DAX post:- DAX Tutorials

Leave a Reply