Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need help finding the appropriate chart and KPI expression for calculating cumulative returns from daily returns. The RangeSum(above function will not work since daily returns are not additive. I am attaching both an XL spreadsheet where cumulative returns are calculated from (given) daily returns and a .qvf file with an example. In this app you can see a chart of the cumulative returns from XL and the corresponding line using Rangesum(above... which leads to some errors after just a few days already (so you can imagine over several years).
The expression needs to calculate cumulative return from any date range selected in the date filter on the app. So this needs to be a dynamic expression (which is the advantage of doing this in Qlik instead of XL). If someone can help me with this app or has an app in which this is done to share, that would be great.
Olivier
Try this in a KPI object
FirstSortedValue(Aggr(exp(RangeSum(Above(log(1+[Daily Returns]), 0, RowNo()))) - 1, Date), -Date)
Try this
exp(RangeSum(Above(log(1+[Daily Returns]), 0, RowNo()))) - 1
Updated the line chart as well
Brilliant! Thank you so much for this.
I tried to modify your expression to add a KPI but could not make it work. I get either a "-" or "0.0%". Any ideas on how to edit the expression for the end-of-period KPI?
Olivier
What number are you hoping to see in the KPI? The average of all the numbers or something else?
Try this in a KPI object
FirstSortedValue(Aggr(exp(RangeSum(Above(log(1+[Daily Returns]), 0, RowNo()))) - 1, Date), -Date)