Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlikview: Convert & Create dates

Hello,

I have a source, where date is formatted in month and year columns:

date.png

I want to convert it to MM.YYYY format and use it as Time dimension in charts etc.

I already tried this function: DATE (MakeDate(MONTH('month'),YEAR('year')),'MM.YYYY') as date2,

but did not solve the problem. After load, new field date2 just shows '-'

Perhaps it is conflicted with my SET statements:

SET DateFormat='DD.MM.YYYY';

SET FirstWeekDay=0;

SET FirstMonthOfYear=1;

1 Solution

Accepted Solutions
el_aprendiz111
Specialist
Specialist

Hi

TMP:

LOAD *, DATE(MakeDate(year,month),'MM.YYYY') AS MY_DATE, 

;

LOAD * Inline

[

year,month

2018,3

2018,5

2017,11

2018,7

2018,3

2017,11

2017,11

2018,7

];

EXIT SCRIPT;

View solution in original post

4 Replies
m_woolf
Master II
Master II

Year is the first argument for the MAKEDATE function.

From QV Help:

Syntax:

MakeDate(YYYY [ , MM [ , DD ] ])

Return data type: dual

Arguments:

ArgumentDescription
YYYYThe year as an integer.
MMThe month as an integer. If no month is stated, 1 (January) is assumed.
DDThe day as an integer.

If no day is stated, 1 (the 1st) is assumed.

el_aprendiz111
Specialist
Specialist

Hi

TMP:

LOAD *, DATE(MakeDate(year,month),'MM.YYYY') AS MY_DATE, 

;

LOAD * Inline

[

year,month

2018,3

2018,5

2017,11

2018,7

2018,3

2017,11

2017,11

2018,7

];

EXIT SCRIPT;

Anonymous
Not applicable
Author

Thank you, MakeDate in the right order with Inline load worked perfectly!

sasiparupudi1
Master III
Master III

Try changing your expression to Date(MonthEnd(makedate(2018,3)),'MM.YYYY')