Discussion Board for collaboration on QlikView Scripting.
Can anyone teach me how to do rolling sum in scripting level?
I understand how to use RangeSum and Above functions in the expression but Above is not available in the scripting.
Thank you very much in advance.
PS: Here are two examples.
It would be great if I can do something like this:
Another example would be:
In script you can use the Peek() or Previous() to get the previous row values. I think Peek() would be the best pick, because you can give the offset.
You can consider the 'AsOf' tables approach.
Have a look at this.
Calculating rolling n-period totals, averages or other aggregations
Can you give me an example of how to use Peek() with its parameters?
Try this script
Numsum([Head Count], Previous([Head Count]), Previous(Previous([Head Count])), Previous(Previous(Previous([Head Count]))), Previous(Previous(Previous(Previous([Head Count])))), Previous(Previous(Previous(Previous(Previous([Head Count])))))) AS [Rolling 6 Month Head Count];
Date(Date#(Date, 'DD-MM-YYYY')) AS Date,
(html, codepage is 1252, embedded labels, table is @1);
I thought you were going to use PEEK() as an example.
But this PREVIOUS() works fine as well. And it is simply. Just need to repeat the function several times.
For anyone want something more sophisticated, maybe this is not what you are looking for.
Tried using Peek(), but getting some issues, that's why I did this using Previous(), anyway we are using only 6 rolling months so it is not a problem.