Forum Discussion

BrendanC89's avatar
BrendanC89
Frequent Visitor
7 years ago
Solved

Calculate Moving average by shift by group

Hi, 

 

Trying to work out how to calcuate the moving avereage if the last 3 values in data set by group. 

 

Essentially Calculate the last 3 values in a column. 

 

eg

Group    Value      Shift

1            2             D1

2            4             D1

3            2             D1

1            3             D2

2            3             D2

3            5             D2

1            5             D3

2            0             D3

3            5             D3

 

I Would expect the result to report in D1 

              1           2         3      

D1          3.33      2.33    4

 

 

Any help would be appreciated

 

Thank you

 

3 Replies