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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Rozgonyi
Partner - Contributor II
Partner - Contributor II

Time-Weighted Return Calculation

Hello everyone,

Has anyone had any experience with TWR calculation in QlikSense?
I have the following formula:
exp(RangeSum(above(log(1+(Sum(Perf_Today)/Sum(Perf_PD))-1),0,Rowno())))-1

“Perf_PD = Previous day”


Works in a table where all dates are present as the first column:

To hide all rows except the last one I used :
If(Date = Max(Total Date)

The complete formula looks like this (TWR) :
If(Date = Max(Total Date)
    ,exp(RangeSum(above(log(1+(Sum(Perf_Today)/Sum(Perf_PD))-1),0,Rowno())))-1
    ,Null())

Risk:
If(Date = Max(Total Date)
   ,sqrt(Date-Top(Date))
    *
    RangeStDev(Above((Sum(Perf_Today)/Sum(Perf_PD))-1,0,Date-Top(Date)))
   ,Null())

Ranking:
If(Date = Max(Total Date)
    ,Rank(Total If(Date(Floor(Aggr(NoDistinct Max(Date),Year)))=Date,[TWR],-200),1,1)
    ,Null())

“Due to the possible minus-performaces -200 is used for ranking, which cannot be"

Unfortunately, this table cannot be sorted by ranking.

The goal would be to sort this table by ranking and to be able to leave out the hidden rows completely.
I cannot implement this in the script because the selection by date must remain dinamic.

If someone could help me, I would be very grateful.
Thanks in advance and SG Richard

Labels (5)
0 Replies