Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

prma7799
Honored Contributor III

create date with makedate function

Hi All,

How to create date with make date function

I have field months like

April

May

June

July

Aug

Sept

Oct

Nov

Dec

Jan

Feb

Mar

excepted output

01-04-2015

01-05-2015

01-06-2015

01-07-2015

01-08-2015

01-09-2015

01-10-2015

01-11-2015

01-12-2015

01-01-2016

01-02-2016

01-03-2016

Thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: create date with makedate function

There are multiple possible solutions, e.g. try something like

MAP:

MAPPING LOAD

Month, Makedate(2015+offset,MonthNum)

INLINE [

Month, MonthNum, offset

April, 4,0

May,5,0

June,6,0

July,7,0

Aug,8,0

Sept,9,0

Oct,10,0

Nov,11,0

Dec,12,0

Jan,1,1

Feb,2,1

Mar,3,1

];

LOAD

     ApplyMap('MAP', YourMonthField, 'No Mapping found') as MonthFieldNew,

     ...

FROM ...;

7 Replies
rajeshforqlikvi
Contributor

Re: create date with makedate function

Returns a date calculated from the year YYYY, the month MM and the day DD.

If no month is stated, 1(January) is assumed.

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

Ex:

makedate( 2016, 2, 14 )

returns

2016-02-14

MVP
MVP

Re: create date with makedate function

There are multiple possible solutions, e.g. try something like

MAP:

MAPPING LOAD

Month, Makedate(2015+offset,MonthNum)

INLINE [

Month, MonthNum, offset

April, 4,0

May,5,0

June,6,0

July,7,0

Aug,8,0

Sept,9,0

Oct,10,0

Nov,11,0

Dec,12,0

Jan,1,1

Feb,2,1

Mar,3,1

];

LOAD

     ApplyMap('MAP', YourMonthField, 'No Mapping found') as MonthFieldNew,

     ...

FROM ...;

rajeshforqlikvi
Contributor

Re: create date with makedate function

Makedate(2015,4,1);

Makedate(2015,5,1)

like this you can create all dates ....

prma7799
Honored Contributor III

Re: create date with makedate function

Hi swuehl‌,

I tried your solution but I am getting date field without months.

see below,

mont.png

Also find script.

MVP
MVP

Re: create date with makedate function

Try this:

Date(ApplyMap('MAP', Month, 'No Mapping found') ,'dd-MM-yyyy') as t

mm is for minutes and MM is for Months

prma7799
Honored Contributor III

Re: create date with makedate function

Hi sunindia‌,

Now am getting date field in my target fields can we link these to the master calendar

Please look into this how to add excel file into existing data model

Re: create date with makedate function

Or simply try,

MakeDate(2015,Month(Date#(Left(Month,3),'MMM'))) as Date