Forum Discussion

mmunoa's avatar
mmunoa
Regular Visitor
5 years ago
Solved

Tracking cost increase or decrease

Hi!   First of all, thanks in advance for the help!   I have to calculate the increase of costs for different product from different suppliers between dates. So for that I have a table called "p...
  • amitchandak's avatar
    5 years ago

    mmunoa , Can you try the Min Cost Like

     

    Cost_MinDate =
    var firstdate = maxx('price_history','price_history'[UPDATE DATE])
    return
    calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
    filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate))

     

    or

     

    Cost_MinDate =
    var firstdate = maxx('price_history','price_history'[UPDATE DATE])
    return
    calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
    filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate && 'price_history'[product] =max('price_history'[product])))

     

    or

     

    Cost_MinDate =
    var firstdate = maxx('price_history','price_history'[UPDATE DATE])
    return
    calculate (lastnonblankvalue('price_history'[UPDATE DATE],[COST]),
    filter (all('price_history'),'price_history'[UPDATE DATE]<firstdate && 'price_history'[product] =max('price_history'[product] && 'price_history'[SUPPLIER] =max('price_history'[SUPPLIER])))