1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| LOAD Min(Date) as MinDate,
Max(Date) as MaxDate
Resident Facts;
Let vMinDate = Num(Peek('MinDate', 0, 'MinMax'));
Let vMaxDate = Num(Peek('MaxDate', 0, 'MinMax'));
Let vToday = $(vMaxDate) ;
TempCal:
LOAD
date($(vMinDate)+Rowno()- 1) as TempDate
AutoGenerate
$(vMaxDate) - $(vMinDate) + 1;
DROP TABLE MinMax;
MasterCalendar:
LOAD
TempDate as Date,
Week(TempDate) as Week,
Year(TempDate) as Year,
Month(TempDate) as Month,
Day(TempDate) as Day,
WeekDay(TempDate) as WeekDay,
'Q' & ceil(month(TempDate)/3) as Quarter,
Date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
Week(TempDate)&'-'&Year(TempDate) as WeekYear,
InYearToDate(TempDate, $(vToday), 0) * -1 as CurYTDFlag,
InYearToDate(TempDate, $(vToday), -1) * -1 as LastYTDFlag
RESIDENT TempCal
Order by TempDate ASC;
DROP Table TempCal; |
Partager