LOOKUPVALUE and RELATEDTABLE

Getting values from another table: with a relationship that is RELATED, without one LOOKUPVALUE. RELATEDTABLE goes the other way and returns all matching rows.

In short: LOOKUPVALUE(result column, search column, search value) looks up like VLOOKUP and needs no relationship. RELATED(Table[Column]) fetches the value from the one side through the relationship. RELATEDTABLE(Table) returns, from the one side, all rows of the many side.

Before this: Calculated columns (RELATED) and Time intelligence.

Try it now

Task Create the calculated column "List Price" in Sales: the price from Product, looked up by ProductID, using LOOKUPVALUE.

Sales 120 rows, 7 columns
OrderIDOrderDateShipDateProductIDRegionIDQuantityAmount
13 Oct 20266 Oct 20261221798
29 Nov 202519 Nov 20252351145
320 Sep 202627 Sep 2026544596
416 Jun 20252 Jul 20252151145
526 Mar 202631 Mar 20261343596
64 Dec 202510 Dec 2025545745
78 Jul 202526 Jul 2025614196
820 Feb 20251 Mar 202532359.7
99 Dec 202524 Dec 202562298
1012 Aug 202625 Aug 2026212458
117 Sep 202612 Sep 2026542298
122 Mar 202614 Mar 2026623147

Showing the first 12 of 120 rows.

Measures: [Total Sales]

Product 6 rows, 4 columns
ProductIDProductCategoryPrice
1LaptopHardware899
2MonitorHardware229
3MouseAccessories19.9
4KeyboardAccessories39.9
5Office suiteSoftware149
6AntivirusSoftware49
Region 4 rows, 2 columns
RegionIDRegion
1North
2South
3West
4East
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

LOOKUPVALUE or RELATED?

RELATEDLOOKUPVALUE
Needs a relationshipyesno
Lookup on several columnsnoyes, more pairs of search column and value
No matchblankblank, or an alternate result as the last argument
Several matches with different valuescannot happen (one side)error, unless there is an alternate result

If there is a relationship, RELATED is the better choice: shorter and faster. LOOKUPVALUE is worth it for tables without a relationship, such as a price list looked up by product and year.

RELATEDTABLE: the other direction

In a column of the product table, each product has many orders. RELATEDTABLE returns them as a table, and COUNTROWS or SUMX aggregate them.

Task Create the calculated column "Orders" in Product: how many rows in Sales belong to each product. RELATEDTABLE returns them through the relationship.

Sales 120 rows, 7 columns
OrderIDOrderDateShipDateProductIDRegionIDQuantityAmount
13 Oct 20266 Oct 20261221798
29 Nov 202519 Nov 20252351145
320 Sep 202627 Sep 2026544596
416 Jun 20252 Jul 20252151145
526 Mar 202631 Mar 20261343596
64 Dec 202510 Dec 2025545745
78 Jul 202526 Jul 2025614196
820 Feb 20251 Mar 202532359.7
99 Dec 202524 Dec 202562298
1012 Aug 202625 Aug 2026212458
117 Sep 202612 Sep 2026542298
122 Mar 202614 Mar 2026623147

Showing the first 12 of 120 rows.

Measures: [Total Sales]

Product 6 rows, 4 columns
ProductIDProductCategoryPrice
1LaptopHardware899
2MonitorHardware229
3MouseAccessories19.9
4KeyboardAccessories39.9
5Office suiteSoftware149
6AntivirusSoftware49
Region 4 rows, 2 columns
RegionIDRegion
1North
2South
3West
4East
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

In real Power BI

  1. In Table view, select the table and choose New column.
  2. Type the formula and check the new column in Table view, for example rows without a match.

Common mistakes

Several matches

LOOKUPVALUE(Product[Price], Product[Category], "Hardware") finds two products with different prices. Power BI then reports that a table of multiple values was supplied where a single value was expected.

RELATED in the wrong direction

There is no RELATED(Sales[Amount]) in the product table: a product has many orders. That is what RELATEDTABLE is for.

FAQ

Does LOOKUPVALUE work in a measure?

Yes, but the search value must then be a single value, such as SELECTEDVALUE of a column. Usually a relationship with CALCULATE is the better solution.

Up next: DAX queries

Querying your own tables with EVALUATE and checking measures.

Next lesson

Write to us

Choose language

Select your preferred language