Skip to main content

Hi All,

 

I have a table which has a timestamp every one hour. 

 

I would like to create a 4 week rolling average considering the following -  the last 4 timestamps for the same day of the week and for the same hour. 

 

As an example - 

 

To calculate the 'Rolling 4 week' average for date 1/26/20 0:55 (Sunday 0.55 hrs)  its value will be null as it has no other previous values to compare.

For the next Sunday and at 0.55 hrs  2/2/20 the value will be the previous value of 11.69. 

For the next Sunday 2/9/20 at 0.55 hrs the value will be the average of 11.69 and 3.62 which is 7.655

For the next Sunday 2/16/20 at 0.55 hrs the value will be the average of 11.69, 3.62 and 6.07 which is 7.1266

For the next Sunday 2/23/20at 0.55 hrs the value should be the average of 11.69, 3.62,6.07 and 5.87 which is 6.81

For the next Sunday 3/1/20 at 0.55 hrs the value should be a average of 3.62,6.07 ,5.87 and 6.7  which is 5.565.

 

But then I need the 1/27/2020 00:55 value to Null rather than 57.61.

 

I have used the calculation -      Window_avg(SUM([Timetaken]),-4,-1) for 'Rolling 4 week' average

 

null

 

Any advise would be helpful.

 

Regards,

Rishi Saka

4 个回答
  1. 2020年3月9日 01:34

    Hi Rishi -

    You need to partition your table calc accordingly.  Need to un-check [Day].

     

    Hi Rishi -You need to partition your table calc accordingly. Need to un-check [Day].

0/9000