Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mjperreault
Creator
Creator

YTD Set Analysis for Weighted Average

Hi All,

I am struggling to put together a formula and was wondering if anyone has any ideas.

 

I have data such as the below (I've also attached the excel file with formulas for reference).  The columns I actually have in my data are [Month Year],[Year],[Month],[Days_In_Month],[Inflows_Outflows],[Rolling_Total].  I want to be able to dynamically calculate Weighted_Total in Qlik.

 

Month YearYearMonthDays_In_Month Inflows_Outflows Rolling_TotalWeighted_Total
Jan-192019Jan31           5,000,000.00   186,123,300.00         186,123,300.00
Feb-192019Feb28                                 -     186,123,300.00         186,123,300.00
Mar-192019Mar31             (489,699.00)   185,633,601.00         185,954,625.90
Apr-192019Apr30                                 -     185,633,601.00         185,874,369.68
May-192019May31                                 -     185,633,601.00         185,824,940.34
Jun-192019Jun30               250,000.00   185,883,601.00         185,834,663.10
Jul-192019Jul31                                 -     185,883,601.00         185,841,819.12
Aug-192019Aug31                                 -     185,883,601.00         185,847,149.32
Sep-192019Sep30                                 -     185,883,601.00         185,851,155.00
Oct-192019Oct31             (100,000.00)   185,783,601.00         185,844,266.27
Nov-192019Nov30                                 -     185,783,601.00         185,838,817.29
Dec-192019Dec31                                 -     185,783,601.00         185,834,127.69

 

The Weighted_Total column is calculated using a Weighted Average of the Rolling_Total and Days in Month which is then rolled along through the remainder of the months.

 

My goal is to be able to select one Month Year in Qlik and have a formula for a KPI that calculated the Weighted_Total.

@sunny_talwar  was wondering if you had any ideas

 

Thanks!
Mark

 

 

Labels (3)
1 Solution

Accepted Solutions
vunguyenq89
Creator III
Creator III

Hi,

You can use Set Analysis for the measure. For example, try the KPI measure below:

=If(GetSelectedCount([Month Year]) = 1,
Sum({<[Month Year] = {"<=$(=[Month Year])"} >} Rolling_Total * Days_In_Month) / Sum({<[Month Year] = {"<=$(=[Month Year])"} >} Days_In_Month)
,'Please select one MonthYear')

test.png

Hope this helps,

BR,

Vu Nguyen

View solution in original post

1 Reply
vunguyenq89
Creator III
Creator III

Hi,

You can use Set Analysis for the measure. For example, try the KPI measure below:

=If(GetSelectedCount([Month Year]) = 1,
Sum({<[Month Year] = {"<=$(=[Month Year])"} >} Rolling_Total * Days_In_Month) / Sum({<[Month Year] = {"<=$(=[Month Year])"} >} Days_In_Month)
,'Please select one MonthYear')

test.png

Hope this helps,

BR,

Vu Nguyen