Looking Up with RELATED
Part of the Power BI Basics section of Coddy's Power BI journey. Lesson 24 of 28.
A Sales column cannot read Products[UnitCost] directly: which product?
RELATED follows the relationship to the matching row and brings back its value.
Cost = Sales[Quantity] * RELATED(Products[UnitCost])It works from Sales towards a lookup table, which has one row per key.
Challenge
EasyAdd a column Cost to Sales: the quantity times the unit cost of the product, looked up in Products.
Try it yourself
Cost =| Date | Quantity | Cost |
|---|---|---|
| 2024-01-12 | 3 | |
| 2024-01-20 | 2 | |
| 2024-01-24 | 4 |
- Sales
- OrderID
- Date
- StoreID
- ProductID
- CustomerID
- Quantity
- UnitPrice
- Amount
- Products
- Stores
- Customers
- Dates
- Targets
All lessons in Power BI Basics
1Meet Power BI
What Power BI IsTables, Rows and ColumnsYour First ChartSum, Count and AverageFilters and SlicersRecap - Mia's First Report4Calculated Columns
Columns vs MeasuresIF in a ColumnText ColumnsLooking Up with RELATEDColumns Feed MeasuresProfit and MarginWhen to Use WhichRecap - Profit by Category