Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

RELATED/RELATEDTABLE with condition

I have two tables (1) Order Details (Date, SKU, Units Sold) and (2) Cost (SKU, Unit Cost, Year).   I need to bring in Unit Cost to my Order Details table so I can get my COGS. But I also need to ev...
  • Ashish_Mathur's avatar
    7 years ago

    Hi,

    In the Order Details Table, create a calculated column to extract Year from the Date: Year = YEAR('Order Details'[Date]).  Assuming every Year and SKU record in the Cost Table is a unique combination, try this calculated column formula in the Order Details Table

    =LOOKUPVALUE('Cost'[Unit Cost],'Cost'[SKU],[SKU],'Cost'[Year],[Year])

    This formula should work without creating any relationship betwenn the 2 Tables.

    Hope this helps.