Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

rolling sum

Hello Community,

 

Hope you are well.

 

I need your help with the below challenge.

 

I want to produce a table at which :

  • Hard Benefit 1 : the total sum of per year will be the sum of the value of this year plus all the values of the previous ones
  • Hard Benefit 2 : same as above

For example, the correct answer to the question "what is the value of hard benefit 1 that the project PR1 has delivered in 2020?" will be 104+27, instead of 27.

 

Table 1 : Raw Data

ProjectYearHard Benefit 1Hard Benefit 2Hard Benefit 3
PR120191040108
PR120202741109
PR12021105670
PR22021886330
PR22022110079
PR32020985266

 

Table 2 : Desired Outcome

  20192020202120222023
PR1Hard Benefit 1104104+27104+27+105104+27+105104+27+105
 Hard Benefit 204141+6741+6741+67
 Hard Benefit 3108109000
PR2Hard Benefit 1008888+11088+110
 Hard Benefit 200636363
 Hard Benefit 300307979
PR3Hard Benefit 1098989898
 Hard Benefit 2052525252
 Hard Benefit 3066000

 

Hope my explanation makes sense.

 

Thank you in advance,

 

George

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello ryan_mayu 

       

      Thank you for your reply. I noticed that your solution has an error. More specifically, it summarizes the values per year, but it ignors the breakdown per benefit type.

       

      For example, the value of project PR1, hard benefit 1, year 2019 is 104. Your solution shows 212 instead, which is the sum of hard benefit 1 (value 104) and hard benefit 3 (value 108) for year 2019.

       

      Thank you,

       

      George