Forum Discussion

wojbal's avatar
wojbal
Frequent Visitor
4 years ago
Solved

Calculate difference between values in one table based on column

Hello,   Would you be able to help me resolve the issue where I would like to calculate and show the difference in prices which happened from a week ago (2weeks and 3 weeks) by today and show what ...
  • davehus's avatar
    4 years ago

    Hi wojbal ,

     

    Use the following 

     

    Todays Price = CALCULATE(SUM(Test[Price]), KEEPFILTERS(Test[Weeks] = "Today"))
    Price 1 Weeks Ago = CALCULATE(SUM(Test[Price]), KEEPFILTERS(Test[Weeks] = "1 Week Ago"))
    Price 2 Weeks Ago = CALCULATE(SUM(Test[Price]), KEEPFILTERS(Test[Weeks] = "2 Weeks Ago"))
    Price 3 Weeks Ago = CALCULATE(SUM(Test[Price]), KEEPFILTERS(Test[Weeks] = "3 Weeks Ago"))
     
    And subtract as required.