Forum Discussion

Masatoshi's avatar
Masatoshi
Frequent Visitor
3 years ago
Solved

How to Calculate Measure and Relative Table Columns

I am looking for a way to calculate the following using two tables that have a many-to-one relationship, but I can't find it. Can you please provide me with a DAX that can solve this? --------------...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Masatoshi ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a measure. 

    Margin = 
    var _cost = LOOKUPVALUE(Operation[Cost],'Operation'[Date],MAX('Sales'[Date]))
    return 'Sales'[Daily_Amount]-_cost

    (3) Then the result is as follows.

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.