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: 
pkelly
Specialist
Specialist

EWMA (Exponentially Weighted Moving Average)

Our Stock people have asked us to look at using EWMA instead of a 3 Month Average within our Stock Management Suite.

Does anyone have experience of using this method within QlikView / can provide a QVW example of how it works?

Many thanks in advance to anyone who can help.

Regards

Paul

1 Reply
pkelly
Specialist
Specialist
Author

Hi All, found the following:

The EWMA algorithm requires a decay factor, alpha. The larger the alpha, the more the average is biased towards recent history. The alpha must be between 0 and 1, and is typically a fairly small number, such as 0.04. We will discuss the choice of alpha later.

The algorithm works thus, in pseudocode:

  1. Multiply the next number in the series by alpha.
  2. Multiply the current value of the average by 1 minus alpha.
  3. Add the result of steps 1 and 2, and store it as the new current value of the average.
  4. Repeat for each number in the series.

There are special-case behaviors for how to initialize the current value, and these vary between implementations. One approach is to start with the first value in the series; another is to average the first 10 or so values in the series using an arithmetic average, and then begin the incremental updating of the average. Each method has pros and cons.

I suppose the best thing for me to do is create a function - any pointers?