Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to generate all month starts between From and To date i.e.
From : 01/03/21
To: 01/06/21
Desired Ouput: 01/01/21 ,01/02/21,01/03/21 .....01/12/21
With below script I am getting only dates between From and To.Can someone please help !!!!
tmpCalender:
LOAD
Date(min([From]),'DD/MM/YYYY') as MinBDate,
Date(max([To]),'DD/MM/YYYY') as MaxBDate
Resident D;
LET vDateMin = Num(Peek('MinBDate', 0, 'tmpCalender'));
LET vDateMax = Num(Peek('MaxBDate', 0, 'tmpCalender'));
TempCalendar1:
LOAD
$(vDateMin) + RowNo() - 1 AS Date_Key,
Date($(vDateMin) + RowNo() - 1) AS Date
AUTOGENERATE 1
WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);
Master_Calendar:
load
Date(MonthStart(Date),'DD/MM/YYYY') as Calendar_Date
Resident TempCalendar1;
DROP Table TempCalendar1,tmpCalender;
IntervalMatch:
IntervalMatch(Calendar_Date)
LOAD Distinct [From],
[To]
Resident D;
Try this:
//D:
//Load
// Date(From,'MM/DD/YY') as From,
// Date(To,'MM/DD/YY') as To;
//Load * Inline [
//From, To
//01/03/21, 01/06/21
//];
tmpCalender:
LOAD
Date(min(YearStart([From])),'DD/MM/YY') as MinBDate,
Date(max([To]),'DD/MM/YY') as MaxBDate
Resident D;
LET vDateMin = Num(Peek('MinBDate', 0, 'tmpCalender'));
LET vDateMax = Num(Peek('MaxBDate', 0, 'tmpCalender'));
TempCalendar1:
LOAD
$(vDateMin) + RowNo() - 1 AS Date_Key,
Date($(vDateMin) + RowNo() - 1) AS Date
AUTOGENERATE 1
WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);
Master_Calendar:
load
Date(MonthStart(Date),'MM/DD/YY') as Calendar_Date
Resident TempCalendar1;
DROP Table TempCalendar1,tmpCalender;
IntervalMatch:
IntervalMatch(Calendar_Date)
LOAD Distinct [From],
[To]
Resident D;