Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Partner
Partner

Rolling correlations

Hi all,

I wanted to know if it is possible to do a rolling correlations chart like that which is available on the financial app Koyfin?

Below is a screenshot where AAPL (Apple) has been chosen to be compared with SPY (S&P 500 index). The bottom line chart is the time series of daily share price for both but the chart above is a rolling correlation chart with a look back period (N) of 21 days.

I wanted to know if there was a way to do something like this on time series data in QlikView or Qlik Sense so that you can choose N amount of look back days?

Please help - thank you!

Koyfin correlations.PNG

1 Solution

Accepted Solutions

Re: Rolling correlations

maybe you could use an expression like

RangeCorrel(Above([Stock 1],0,21),Above([Stock 2],0,21))

?

hope this helps

regards

Marco

View solution in original post

5 Replies
Partner
Partner

Re: Rolling correlations

Hi,

Hard to define without seeing your exact data, but using RangeSum() and Above() is a good bet.

Something like

Avg(RangeSum(Above(Sum(YourValue),0,vDaysToAverage))) Should work, where YourValue is the value you are calculating and vDaysToAverage is over how many days the average is for.

Hope it helps!

Re: Rolling correlations

please post some sample data and your expected result.

Partner
Partner

Re: Rolling correlations

Hi all,

Thanks for the replies. Please find attached an example time series with 2 stocks in there (it's not for the image above as that was just a screenshot from an app where I'd seen this being done).

Here's the data.

Re: Rolling correlations

maybe you could use an expression like

RangeCorrel(Above([Stock 1],0,21),Above([Stock 2],0,21))

?

hope this helps

regards

Marco

View solution in original post

Partner
Partner

Re: Rolling correlations

Thanks everyone - the RangeCorrel works a treat.