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

Set Analysis (Rolling Expression)

Hello Guys,

Help me in below set expression , not able to achieve this from long time.

Requirement is to get the Rolling of sales

Time period to considered is (Previous 9 months + Current Month + Next 2 months)

Below is the sample data, mentioned rolling period below for understanding.

Same KPI is Used in Tables charts, KPI box.

Expression i tried is as below.

Sum({<Date = {">=$(=MonthStart(AddMonths(Date(Max(Date)),-9)))
<=$(=Monthend(AddMonths(Date(Max(Date)),2)))"}>}Sales)

Issue:Max date should calculate row level in table, but above expression max date is calculated on whole App.

I can't use Range sum because some months data is missing and also the same kpi is mentioned in KPI Box and many charts with lowest granularity.

Thanks in Advance 🙂

 

ProductDateYearMonthSalesSales_PredRolling Period to be considered(Prev 9 + CurMon + Next 2)
P014/1/20202020410033004/2020 to 06/2020
P015/2/20202020511046004/2020 to 07/2020
P016/2/20202020612060004/2020 to 08/2020
P017/3/20202020713075004/2020 to 09/2020
P018/3/20202020814091004/2020 to 10/2020
P019/3/202020209150108004/2020 to 11/2020
P0110/4/2020202010160128004/2020 to 12/2020
P0111/4/2020202011170146004/2020 to 01/2021
P0112/5/2020202012200162004/2020 to 02/2021
P011/5/202120211180176004/2020 to 03/2021
P012/5/202120212160178005/2020 to 04/2021
P013/8/202120213140177006/2020 to 05/2021
P014/8/202120214120165007/2020 to 06/2021
P015/9/202120215100152008/2020 to 07/2021
P024/1/20202020480180 
P025/2/20202020560200 
P026/2/20202020640330 
P027/3/20202020720490 
P028/3/202020208130680 
P029/3/202020209160900 
P0210/4/20202020101901150 
P0211/4/20202020112201430 
P0212/5/20202020122501740 
P021/5/2021202112802080 
P022/5/2021202123102370 
P023/8/2021202133402710 
P024/8/2021202143702670 
P025/9/2021202154002650 
Labels (2)
2 Replies
Anil_Babu_Samineni

Perhaps this?

Sum(Aggr(Sum({<Date = {">=$(=MonthStart(AddMonths(Date(Max(Date)),-9)))
<=$(=Monthend(AddMonths(Date(Max(Date)),2)))"}>}Sales), Dim1, Dim2))

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
qlik4asif
Creator III
Creator III
Author

Thanks for the reply ,

But expression is not working