Forum Discussion

rschaudhr's avatar
rschaudhr
Resolver II
5 years ago
Solved

Calculated Column sum last 60 days

Here is the data below:

 

DateIndexDataCalculated column - Data_Index
2018011100 
2018022200 
201803350350
201805450300
2018065400500
201809625475

 

So I have the above table. I have date, index and data column. I want to create a calculated column with takes the values from index and data and add the last 3 day (including the current row). So for example, index 3, the calculated column would have 350 which is (50 [index 3] + 200[index 2] + 100[index 3]). 

Is there any way to accomplish this?

Thank you

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    rschaudhr So, maybe:

    Column =
      VAR __Min = [Date]-60
    RETURN
      SUMX(FILTER('Table',[Date]<=EARLIER([Date]) && [Date]>=__Min),[Date])
    • rschaudhr's avatar
      rschaudhr
      Resolver II

      Hi Thanks for the code. However, it is adding the dates not the data. I will see if I can modify it.

  • rschaudhr , a new column like

    sumx(filter(Table, [index] <=earlier([index]) && [index] >=earlier([index])-2),[Data])