Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Fred12
Contributor III
Contributor III

moving Average in qliksense

Hello, I got a data like that : 

Week          Quantity

1                   1000

2                   1500

3                   4000

4                    6000

5                   2000

6                   800

7                   9000

8                   34000

9                     450

10                   100

 

I would like calculate for each week the moving average of order 3

Then, I would get 

 

 

Week          Quantity

1                   1000

2                   1500    (1000+1500+4000)/3

3                   4000    (1500+4000+6000)/3

4                    6000 (4000+6000+2000)/3            ect ect 

5                   2000   

6                   800

7                   9000

8                   34000

9                     450

10                   100

 

I tried to use function rangeavg but it never takes me previous value or good values

 

Thanks in advance 

Labels (3)
1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Fred,

Try using RangeAvg() in combination with Above(). The second parameter of Above() is the offset. You should use offset 1 to start the calculation with the next row after the current row.

I usually see moving averages calculated starting with the current value and going N values back. This is the first time when I see a moving average that includes both the past and the future numbers - and this is exactly what the Offset parameter is for.

Good luck,