Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to Calculate 3 month moving average in set analysis

Hi All,

I Need help to get a 3 month Moving Average in set analysis, below is the source data for reference, i am using the below expression to get the ConversionRate%

count(DISTINCT{$<  %ProcessingType={'Disbursement'},PROCESS,[Rework Group]= ,[Month Num]>} CASE_NUM)/

count(DISTINCT{$<  %ProcessingType={'Creation'},PROCESS,[Rework Group]=,[Month Num] >} CASE_NUM)

Month#Disb#NewConversionRate%
Jan-16                1,799              2,04988%
Feb-16                1,187              1,97760%
Mar-16                1,587              1,67395%
Apr-16                1,102              1,22490%
May-16                1,074              1,74262%
Jun-16                1,091              1,92257%
Jul-16                1,066              1,30981%
Aug-16                1,197              1,77767%
Sep-16                    201                  46144%

Now i need the 3 month Moving average as below (i,e For March value=March+Feb+Jan)

Month#Disb (3month)#New(3Month)ConversionRate%
Jan-16                1,799              2,04988%
Feb-16                2,986              4,02674%
Mar-16                4,573              5,69980%
Apr-16                3,876              4,87480%
May-16                3,763              4,63981%
Jun-16                3,267              4,88867%
Jul-16                3,231              4,97365%
Aug-16                3,354              5,00867%
Sep-16                2,464              3,54769%

I tried using "ACCUMULATE 3 Steps Back in Expression" it applied only for Disb & New but not for the Conersion rate%, Can anyone help me to write a set analysis to achive the 3 months moving conversionRate% as in the 2nd table.

Thanks In Advance.

Arjin.

4 Replies
arulsettu
Master III
Master III

maybe like this

count(DISTINCT{$<  %ProcessingType={'Disbursement'},PROCESS,[Rework Group]= ,[Month Num],date={">=$(=MonthStart(Max(date), -3))<=$(=Max(date))"}>} CASE_NUM)/

count(DISTINCT{$<  %ProcessingType={'Creation'},PROCESS,[Rework Group]=,[Month Num],,date={">=$(=MonthStart(Max(date), -3))<=$(=Max(date))"} >} CASE_NUM)

date is your date field

Anil_Babu_Samineni

Arul, How about this?? Please correct me if i am wrong, Because he might looking current stage Date for last 3 months

count({$<  %ProcessingType={'Disbursement'},PROCESS,[Rework Group]= ,[Month Num],date={">=$(=AddMonths(Max(date), -3))<=$(=Max(date))"}>} CASE_NUM)/

count({$<  %ProcessingType={'Creation'},PROCESS,[Rework Group]=,[Month Num],,date={">=$(=AddMonths(Max(date), -3))<=$(=Max(date))"} >} CASE_NUM)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Thanks for your time Arul & Anil,

i used the below expression and it worked fine for me.

sum( aggr( rangesum( above( Count( {$<Month,%ProcessingType={'Disbursement'},PROCESS,[Rework Group]=,[Month Num]>}  CASE_NUM),0,3) ),Month))/

sum( aggr( rangesum( above( Count( {$<Month,%ProcessingType={'Creation'},PROCESS,[Rework Group]=,[Month Num]>}  CASE_NUM),0,3) ),Month))

Thanks to Elifs post Accumulative Sums.

Cheers,

Arjin.

sunny_talwar

Try this:

RangeSum(Above(Count(DISTINCT{$<%ProcessingType ={'Disbursement'}, PROCESS, [Rework Group], [Month Num]>} CASE_NUM), 0, 3))

/

RangeSum(Above(Count(DISTINCT{$<%ProcessingType = {'Creation'}, PROCESS, [Rework Group], [Month Num]>} CASE_NUM), 0, 3))