Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to create a calendar starting from a Date which is in form YYYYMM only.
My starting point is CodLoad which is a date filed starting from 201701 to 202004, but every month another set of data (realting to the current month) is added.
how I have to write the correct code?
i write in this way but is not corret.
minmaxImpieghi:
load
max(CodLoad) as MaxDate,
min(CodLoad) as MinDate
resident Impieghi1;
LET vMin = makedate(2017);
LET vMax = peek('MaxDate');
DROP TABLE minmaxImpieghi;
MASTERCALENDAR :
LOAD
Date(MonthStart($(vMin),IterNo()-1),'YYYYMM') as Data_Calendar
AutoGenerate 1
While MonthStart($(vMin),IterNo()-1) <= $(vMax);
Hi,
Can you pls try this,
MasterCalendar:
load
Date(Data_Calendar) as Date,
Year(Data_Calendar) as Year,
'Q'&Ceil(Month(Data_Calendar)/3) as Quarter,
Month(Data_Calendar) as Month,
Day(Data_Calendar) as Day,
Week(Data_Calendar)as Week;
Calendar:
load
Date(Min_Date + IterNo()-1) as Data_Calendar
while (Min_Date+IterNo()-1)<= Num(Max_Date);
A:
load
Min(date(Codload,'MM/DD/YYYY')) as Min_Date,
Max(date(Codload,'MM/DD/YYYY')) as Max_Date
Resident minmaxImpieghi;
hope it will work
Regards,
DurgadeviKumar
What was the issue when you used the code that you mentioned? Did you get an error or was the output not correct?
the resulting list of dates is not correct...
I expect to obtain dates in the YYYYMM format and my vMax as the last date. Insted I have te following list:
20200401
20200312
20200311
20200310 and so on....
i should obtain
202004 (my vMax)
202003
202002
exc..
Is this may be coming from another table other than your master calendar? It is difficult to know unless you are able to share a sample where we can see the issue