Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator 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
tresesco
MVP
MVP

Correct the Month field format, and try like

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

View solution in original post

4 Replies
aveeeeeee7en
Specialist III
Specialist III

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

tresesco
MVP
MVP

Correct the Month field format, and try like

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

Sokkorn
Master
Master

Hi Upali,

Let try this one

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


Regards,

Sokkorn

upaliwije
Creator II
Creator II
Author

Thanks all