Forum Discussion

DataScope06's avatar
DataScope06
Helper I
3 years ago
Solved

LookupValue matching multiple columns error

I am having issues finding the correct value when matching two text values between tables.   My data model has two tables. The first table is sales_items. The second table is returned_items. I want...
  • DataInsights's avatar
    3 years ago

    DataScope06,

     

    Here are two solutions. A relationship between the tables is not required.

     

    1. Calculated column in table Returned_items:

     

    Price = 
    LOOKUPVALUE ( Sales_items[price], Sales_items[order_id], Returned_items[order_id], Sales_items[sku], Returned_items[sku] )

     

    2. Calculated column in table Returned_items using a composite key. The composite key "order_id-sku" can be created in Power Query or DAX.

     

    Price (composite key) = 
    LOOKUPVALUE ( Sales_items[price], Sales_items[order_id-sku], Returned_items[order_id-sku] )