Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ramcena306
Creator II
Creator II

Future Dates in Master calendar

Hello Team,
I have a below master calendar code and result where i have some future dates.
Is this possible to fill only those future date to PROD_DATUM_MONTH field ?
If no , how can we restrict the maximum dates to till end of fiscal year ? Please help.

QuartersMap:
MAPPING LOAD 
rowno() as Month,
'Q' & Ceil (rowno()/3) as Quarter
AUTOGENERATE (12);
 
Temp:
Load
       min(PROD_DATUM) as minDate,
       max(Today(PROD_DATUM)) as maxDate
Resident Field_Quality_TEMP;
 
Let varMinDate_PROD_DATUM = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate_PROD_DATUM = Num(Peek('maxDate', 0, 'Temp'));
 
DROP Table Temp;
 
TempCalendar:
LOAD
        $(varMinDate_PROD_DATUM) + Iterno()-1 as Num,
        Date($(varMinDate_PROD_DATUM) + IterNo() - 1) as TempDate
        AutoGenerate 1 While $(varMinDate_PROD_DATUM) + IterNo() -1 <= $(varMaxDate_PROD_DATUM);
 
MasterCalendar_PROD_DATUM:
Load *,
      if(Month(Date(PROD_DATUM_MONTH,'MM.YYYY'))<10,
          Year(Date(PROD_DATUM_MONTH,'MM.YYYY')),
          Year(Date(PROD_DATUM_MONTH,'MM.YYYY'))+1) as PROD_FISCAL_YEAR ;
Load
      TempDate as PROD_DATUM,
      date(monthstart(TempDate), 'MM.YYYY')     as PROD_DATUM_MONTH,
      date(monthstart(TempDate), 'MM.YYYY') as PROD_DATUM_MONTH_V,
      Year(TempDate) as PROD_CALYEAR,
      Year(TempDate) &'-'& ApplyMap('QuartersMap', month(TempDate), Null()) as PROD_CALQUARTER,
      date(monthstart(TempDate), 'YYYYMM') as PROD_CALMONTH,              
  Month(TempDate) as PROD_DATUM_MonthName,
      Day(TempDate) as PROD_DATUM_Day,                 
      Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as PROD_DATUM_WeekYear,
      WeekDay(TempDate) as PROD_DATUM_WeekDay
      
Resident TempCalendar
Order By TempDate ASC;
 
Drop Table TempCalendar;
 
Script resultScript result
Labels (5)
1 Solution

Accepted Solutions
marcus_sommer

...

Temp:
Load
       min(PROD_DATUM) as minDate,
       makedate(....) as maxDate
Resident Field_Quality_TEMP;

...

View solution in original post

3 Replies
marcus_sommer

You may just wrap your max-date with yearend() or simply determining the date directly per makedate(). 

ramcena306
Creator II
Creator II
Author

Hi Marcus,

Thank you for the replay.
Could you please send me the script where i can do the changes.

 

Thanks

marcus_sommer

...

Temp:
Load
       min(PROD_DATUM) as minDate,
       makedate(....) as maxDate
Resident Field_Quality_TEMP;

...