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 result