Forum Discussion

RodrigoCenteno's avatar
RodrigoCenteno
New Member
4 years ago
Solved

Calculate cost based on transaction date

Hello,   I have a Transaction table with the following structure:   DATE     SKU    UNITS   And I have a Cost table like this:   STARTING DATE OF THE COST      SKU     COST        What I ne...
  • amitchandak's avatar
    4 years ago

    RodrigoCenteno , Try

     


    New column =
    var _max = maxx(FILTER (Cost,Transaction[SKU] = Cost[SKU] && Transaction[DATE] <= Cost[STARTING DATE OF THE COST]),Cost[STARTING DATE OF THE COST])
    return
    maxx(FILTER (Cost,Transaction[SKU] = Cost[SKU] && Transaction[DATE] =_max ),Cost[cost])