Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
RK121
Contributor III
Contributor III

Autogenerated Date and Linier Regression for the Forecast

Hello! I have autogenerated new date field UPDATE_DT_TEST  to show the forecast for the next 4 month, but this only works for the full dataset. As soon as I filter any field(like State, City etc.), the future data for linear regression disappears. Does anyone know what can be done in the table settings or maybe script?

I also have a master calendar, but the auto-generated date has to be created separately since we use the master calendar for other tabs (UPDATED_DT exist only if sales present for that state/city)

Script tab:

Let vMaxDate = Num(Date#('12-01-2022','MM-DD-YYYY'));
Let vMinDate = Num(Date#('05-01-2022','MM-DD-YYYY'));


Temp:
LOAD $(vMinDate) + IterNo() as Temp_DT
AutoGenerate 1
While
$(vMinDate) + IterNo() <= $(vMaxDate);


Temp2:
LOAD
If(Temp_DT <= Today(), Date(Temp_DT,'MM/DD/YYYY'), Null()) as UPDATE_DT,

Date(MonthStart(Temp_DT),'MM-YYYY') as UPDATE_DT_TEST
//Date(Temp_DT,'MM/DD/YYYY') as Temp_DT_Date

RESIDENT Temp;

Example: 

RK121_0-1660854295070.png

 

RK121_1-1660854947597.png

 

 

Labels (1)
0 Replies