Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Master Calendar Not Reading Date Properly

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:

qlikview-20170404.png

You will notice that the second record is working properly while the first one is not.

Thank you for your response in advance.

1 Solution

Accepted Solutions
Kushal_Chawda

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);


View solution in original post

45 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi,

May be in 12 line

Day(Date#(PROpenDate, 'DD/MM/YYYY')) As PROpenDateDay,



Anonymous
Not applicable
Author

Nope.. It's giving me the same results .

vikasmahajan


Try this


Day(Date (Num(Evaluate(DATE) ))  ) As PROpenDateDay,


Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Anonymous
Not applicable
Author

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!

Anonymous
Not applicable
Author

Sorry here is the correct statement but still no luck:

Day( Date( Num( Evaluate( PROpenDate ) ) ) ) As PROpenDateDay,

Kushal_Chawda

try this

Day(trim(PROpenDate)) As PROpenDateDay,

Anonymous
Not applicable
Author

Not working.. it's giving me the same outcome from my original post.

ashok1203
Creator II
Creator II

Can you try this

Day( Num#(PROpenDate) ) As PROpenDateDay,

AAK
Kushal_Chawda

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;