LOOKUPVALUE()
Learn how LOOKUPVALUE retrieves a value from another table without requiring an existing relationship.
LOOKUPVALUE()
LOOKUPVALUE() retrieves a value from another table by matching one or more columns — similar to RELATED(), but it works even when no relationship connects the two tables.
LOOKUPVALUE(
Result Column,
Search Column, Search Value,
[Search Column 2, Search Value 2], ...
)Basic Example
Product Category =
LOOKUPVALUE(
DimProduct[Category],
DimProduct[ProductKey], FactSales[ProductKey]
)DimProduct FactSales
ProductKey | Category ProductKey
1001 | Bikes <-- 1001 -> looks up Category = "Bikes"Anatomy of LOOKUPVALUE()
| ProductKey | ProductName | Category |
|---|---|---|
| 10012 | Trail Runner Tire | Bikes3 |
| 1002 | Commuter Helmet | Accessories |
| 1003 | All-Terrain Tire | Bikes |
| 1004 | Bike Lock | Accessories |
Search Value
11001
Result
✓Bikes
Search Value — the value to find: 1001.
Search Column — LOOKUPVALUE() scans ProductKey and finds the match in row 1.
Result Column — it takes the value from Category in that same row.
Result — the measure returns "Bikes". With no match, it would return BLANK() instead (or the optional default value, if one is supplied).
This returns the same result as RELATED(DimProduct[Category]) would, if a relationship existed — the difference is LOOKUPVALUE() doesn't need one.
When a Relationship Doesn't Exist
LOOKUPVALUE()'s main use case is exactly this: pulling a value from a table that isn't (and sometimes shouldn't be) related in the model.
DimExchangeRates FactSales
Currency | Rate Currency | Amount
USD | 1.00 <-- EUR -> looks up Rate for "EUR"
EUR | 1.08Building an actual relationship for a small reference table like exchange rates is often unnecessary — LOOKUPVALUE() reads it directly instead.
Matching on Multiple Columns
More than one search column/value pair can be supplied, all of which must match for a row to qualify.
Price =
LOOKUPVALUE(
PriceList[Price],
PriceList[ProductKey], FactSales[ProductKey],
PriceList[Region], FactSales[Region]
)Only a row where both ProductKey and Region match returns a result — this is how LOOKUPVALUE() handles a composite key without a corresponding composite relationship in the model.
What Happens With No Match, or Multiple Matches
No matching row -> returns BLANK (or a specified default, see below)
Exactly one match -> returns that value
More than one match -> returns an error, unless every matching row has the same valueAn optional final argument sets what to return instead of blank when no match is found:
Price =
LOOKUPVALUE(
PriceList[Price],
PriceList[ProductKey], FactSales[ProductKey],
0
)This returns 0 instead of blank for any product missing from PriceList.
Try it live — edit PriceList or the search key to hit every case
PriceList (lookup target)
| ProductKey | Price |
|---|---|
2 matching rows for ProductKey "103"
ERROR — a table of multiple values was supplied
— 2 rows match ProductKey "103", with different prices. LOOKUPVALUE() doesn't pick one arbitrarily — it errors, because the search column doesn't actually identify a unique row the way a lookup target needs it to.
When It Returns Blank Unexpectedly
If a value you can see in both tables comes back blank, the two keys aren't really equal. Find which keys have no match first, with a temporary calculated column on the table doing the lookup:
Key Exists =
CONTAINS ( PriceList, PriceList[ProductKey], FactSales[ProductKey] )Filter a table visual to FALSE and you have the exact list. Then check:
- Invisible characters. A non-breaking space or a line break copied from another system makes two keys that look identical different. Clean the key column in Power Query before it loads: Transform → Format → Clean, then Trim. See Text.Trim.
- Different types. A text key compared with a number key doesn't return blank; it fails with an error. See comparing values of type Text with values of type Integer, and give both columns the same type in Power Query.
- The key really is missing. New products that aren't in the price list yet. Decide what the result should be and use the alternate result argument, as above.
Case isn't the problem: DAX compares text without regard to case, so "abc" matches "ABC".
LOOKUPVALUE vs. RELATED
| Requires a Relationship | Typical Use | |
|---|---|---|
RELATED() | Yes | Pulling a value across an existing, modeled relationship |
LOOKUPVALUE() | No | Pulling a value from a table intentionally left unrelated, or matched on columns a relationship can't represent |
If a relationship already exists and could be used, RELATED() is simpler and typically performs better — reach for LOOKUPVALUE() specifically when there's no relationship to rely on.
Performance Considerations
LOOKUPVALUE() scans the target table looking for a matching row, rather than following a pre-built relationship index.
Small reference table (rates, price lists) -> fine
Large fact table as the lookup target -> can be slow, scanned per rowIt's well suited to small reference or lookup tables, but using it against a large fact table as the search target is a common source of slow calculated columns.
Common Mistakes
Using LOOKUPVALUE Where a Relationship Would Be Simpler
If the two tables genuinely have a one-to-many relationship that could just be modeled directly, using LOOKUPVALUE() instead adds unnecessary complexity — model the relationship and use RELATED().
Not Handling Multiple Matches
If the search columns don't uniquely identify a row, LOOKUPVALUE() errors instead of picking one arbitrarily — the search columns need to be a real, unique key in the target table.
Using It Against Large Fact Tables
LOOKUPVALUE() against a multi-million-row fact table, especially inside a calculated column evaluated per row, can be significantly slower than an equivalent relationship-based approach.
Best Practices
- Reserve
LOOKUPVALUE()for genuinely unrelated tables, or matches a standard relationship can't express (composite keys, non-key matching). - Confirm the search columns uniquely identify a row in the target table before relying on it in production.
- Prefer
RELATED()whenever an actual relationship exists or reasonably could. - Keep the lookup target small — reference tables and lookup lists, not large fact tables.
Next Steps
Continue learning DAX functions:
Seeing "The key didn't match any rows in the table"? That one isn't from LOOKUPVALUE(): it's a Power Query navigation error. See The Key Didn't Match Any Rows in the Table.