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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
r3iuk
Creator
Creator

Simple Moving Average within a Script

I want to calculate a Simple Moving Average within my loading script. A SQL based example would be something like:

select a.quote_date, a.close_price, AVG(b.close_price) [20_day_sma] from
my_stock a
join my_stock b
on a.quote_date >= b.quote_date
and b.quote_date >= DATEADD(dd,-20,a.quote_date)
group by a.quote_date, a.close_price
order by 1

Is there a way to do this self join technique in QlikView?

Labels (1)
0 Replies