Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Using the Master Calendar to load the date field in the form of Day, Week, Year, etc shows a dash in some records while if I create an additional dimension for that record using the Day(), Week(), or Year(), then it works. Is there something wrong in my script?
LOAD
"OPEN_TIME" as PROpenTime,
Date( Floor( "OPEN_TIME" ) ) as PROpenDate;
SQL SELECT * FROM databasename;
// The Master Calendar
Load
PROpenDate,
week( PROpenDate ) As PROpenDateWeek,
Year( PROpenDate ) As PROpenDateYear,
Month( PROpenDate ) As PROpenDateMonth,
Day( PROpenDate ) As PROpenDateDay,
YeartoDate( PROpenDate )* -1 as PROpenDateCurYTDFlag,
YeartoDate( PROpenDate , -1) * -1 as PROpenDateLastYTDFlag,
date( monthstart( PROpenDate ), 'MMM-YYYY' ) as PROpenDateMonthYear,
ApplyMap( 'QuartersMap' , month( PROpenDate ), Null() ) as PROpenDateQuarter,
Week( weekstart( PROpenDate ) ) & '-' & WeekYear( PROpenDate ) as PROpenDateWeekYear,
WeekDay( PROpenDate ) as PROpenDateWeekDay
Resident themaintable;
Here is a sample of the outcome:
You will notice that the second record is working properly while the first one is not.
Thank you for your response in advance.
I am not sure, what could be the exact reason, but instead directly taking resident try to create calendar based on min and max date
MinMax:
LOAD min(PROpenDate) as MinDate,
max(PROpenDate) as MaxDate
Resident themaintable;
let vMinDate = peek('MinDate',0,'MinMax');
let vMaxDate = peek('MaxDate',0,'MinMax');
Calendar:
LOAD
week( PROpenDate ) As PROpenDateWeek,
Year( PROpenDate ) As PROpenDateYear,
Month( PROpenDate ) As PROpenDateMonth,
Day( PROpenDate ) As PROpenDateDay,
YeartoDate( PROpenDate )* -1 as PROpenDateCurYTDFlag,
YeartoDate( PROpenDate , -1) * -1 as PROpenDateLastYTDFlag,
date( monthstart( PROpenDate ), 'MMM-YYYY' ) as PROpenDateMonthYear,
ApplyMap( 'QuartersMap' , month( PROpenDate ), Null() ) as PROpenDateQuarter,
Week( weekstart( PROpenDate ) ) & '-' & WeekYear( PROpenDate ) as PROpenDateWeekYear,
WeekDay( PROpenDate ) as PROpenDateWeekDay;
LOAD date($(vMinDate)+iterno()-1) as PROpenDate
autogenerate 1
While $(vMinDate)+iterno()-1 <= $(vMaxDate);
Hi,
May be in 12 line
Day(Date#(PROpenDate, 'DD/MM/YYYY')) As PROpenDateDay,
Nope.. It's giving me the same results .
Try this
Day(Date (Num(Evaluate(DATE) )) ) As PROpenDateDay,
Vikas
I think you meant to say:
!Day( Date( Num( Evaluate( PROpenDateDay ) ) ) ) As PROpenDateDay,
Still no luck.. in fact it gave me wrong results even for the correct record, the PROpenDateDay value showed 30!
Sorry here is the correct statement but still no luck:
Day( Date( Num( Evaluate( PROpenDate ) ) ) ) As PROpenDateDay,
try this
Day(trim(PROpenDate)) As PROpenDateDay,
Not working.. it's giving me the same outcome from my original post.
Can you try this
Day( Num#(PROpenDate) ) As PROpenDateDay,
try creating it in below load statement and then call it in calendar
LOAD
"OPEN_TIME" as PROpenTime,
Date( Floor( "OPEN_TIME" ) ) as PROpenDate,
Day( Floor( "OPEN_TIME" ) ) as PROpenDateDay;
SQL SELECT * FROM databasename;