Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
upaliwije
Contributor II

Month & Year

I have following data field in a data table

Month    Year

Jan        2012

Jan        2012

Feb        2013

Mar         2014

and I want to convert it to date field as TRN_DATE. I have written following script which is not working. Kindly let me know where I am wrong

   Date(MonthEnd(Date#([Year] &'-'& [Month],'YYYY-MM')),'DD-MMM-YYYY')     AS [TRN_DATE],

1 Solution

Accepted Solutions
MVP
MVP

Re: Month & Year

Correct the Month field format, and try like

Date(MonthEnd(Date#([Year] &'-'& [Month],'YYYY-MMM')),'DD-MMM-YYYY')     AS [TRN_DATE],

4 Replies
aveeeeeee7en
Valued Contributor III

Re: Month & Year

Hi

Use Makedate() Function.

Date(MonthEnd(makedate(Year,Month,1)),'DD-MMM-YYYY')

First convert your month into Number than use below script.

Try something like this:

Table:

Load *, Date(MonthEnd(makedate(Year,Month,1)),'DD-MMM-YYYY') AS NewDate Inline [

Month, Year

1, 2012

4, 2012

2, 2013

3, 2014

];

Also, See the Attachment.

Regards

Av7eN

MVP
MVP

Re: Month & Year

Correct the Month field format, and try like

Date(MonthEnd(Date#([Year] &'-'& [Month],'YYYY-MMM')),'DD-MMM-YYYY')     AS [TRN_DATE],

Sokkorn
Honored Contributor

Re: Month & Year

Hi Upali,

Let try this one

Date(MonthEnd(Date#([Year] &'-'& [Month],'YYYY-MMM')),'DD-MMM-YYYY')     AS [TRN_DATE],


Regards,

Sokkorn

upaliwije
Contributor II

Re: Month & Year

Thanks all

Community Browser