Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

20 days simple moving average

please provide a explanation on how can we create 20 days SMA in a load script. Have tried to search a lot but in vain.

Also have come across above function which can only be used in chart expressions, right? . please somebody shed a light on this.

2 Replies
isaiasdd
Creator
Creator

You want generate 20 days? Please post an example of what the output should look like.

Anonymous
Not applicable
Author

for the sake of simplicity, consider for the below example i need a 2 days SMA

input table is a table with a daily transaction table

NameDate(DD/MM/YYYY)Amount
peter20/01/2017200
peter21/01/2017100
peter22/01/2017300
peter23/01/2017400
tom20/01/2017450
tom21/01/2017220
tom 22/01/2017100
tom23/01/201750

now the output table should look like this

NameDate(DD/MM/YYYY)AmountSMA Amount
peter20/01/2017200200
peter21/01/2017100150
peter22/01/2017300200
peter23/01/2017400350
tom20/01/2017450450
tom21/01/2017220335
tom22/01/2017100160
tom23/01/20175075