Forum Discussion

John_Peter's avatar
John_Peter
Regular Visitor
6 years ago
Solved

DAX Lookup value

I need help ðŸ˜‰   I have 3 tables including Sales, Customers and Cost per product between 2 dates. I would like to add a calculated column in the sales table which according to the Currency of the ...
  • v-easonf-msft's avatar
    6 years ago

    Hi, John_Peter 

    Try to create calculated column as below:

    Column = [Amount] - (CALCULATE(SUM('Cost'[Value]),FILTER('Cost','Cost'[Attribute] = "Cost"&LOOKUPVALUE('Customers'[Currency],Customers[Customer],'Sales'[Product]) && 'Sales'[Date]>='Cost'[From] && 'Sales'[Date]<='Cost'[To]))*[Qty])

    It shows as below:

     

     

    Here is a demo:
    pbix attach 


    Best Regards,
    Community Support Team _ Eason
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.