Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
dafnis14
Specialist
Specialist

Issue with MakeDate

Hi,

I'm trying to create a date with MakeDate function in a LOAD, but somehow I get null values.

The data:

    

TargetNameTarget_DimMonthTargetTarget_MonthStartDate
XXX10110
XXX10210
XXX10310
XXX10410
XXX12110
XXX12210
XXX12310
XXX12410
XXX14110
XXX14210
XXX14310

The script:

Temp_Targets:

LOAD Target_Dim,

     TargetName,

     Month,

     Target,

     MakeDate(2018,Month,1) as Target_MonthStartDate

FROM

$(vPathTempData)Temp_Targets.qvd

(qvd);

What is the reason?

Thanks!

Message was edited by: Dafnis X attached QVW

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

I think the only reason is that Month isn't numeric - you could check it with num() or isnum() and maybe adjusting it with num#() or trim() or keepchar() and similar.

- Marcus

View solution in original post

7 Replies
sasiparupudi1
Master III
Master III

It works normally for me...Make sure that you are selecting the field from the temp table

T1:

Load * Inline

[

TargetName,Target_Dim,Month,Target, XX

XXX,10,1,10,

XXX,10,2,10,

XXX,10,3,10,

XXX,10,4,10,

XXX,12,1,10,

XXX,12,2,10,

XXX,12,3,10,

XXX,12,4,10,

XXX,14,1,10,

XXX,14,2,10,

XXX,14,3,10

];

Temp_Targets:

NoConcatenate LOAD Target_Dim,

     TargetName,

     Month,

     Target,

     MakeDate(2018,Month,1) as Target_MonthStartDate

Resident T1;

Drop table T1;

sunny_talwar
MVP
MVP

Is your Month field like Jan, Feb, Mar by any chance?

marcus_sommer
MVP
MVP

I think the only reason is that Month isn't numeric - you could check it with num() or isnum() and maybe adjusting it with num#() or trim() or keepchar() and similar.

- Marcus

dafnis14
Specialist
Specialist
Author

Hi,

I attached a QVW...it's a number

dafnis14
Specialist
Specialist
Author

Thanks, but it still doesn't work.

I attached the QVW with the data

sunny_talwar
MVP
MVP

Can you try this

MakeDate(2018,MonthNum*1,1) as Target_MonthStartDate

or this

MakeDate(2018,Num#(MonthNum),1) as Target_MonthStartDate

dafnis14
Specialist
Specialist
Author

You were right!

num# solved it. Thanks!