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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script issue with Microsoft Excel Date field

My data source is an Excel spreadsheet. One of the columns (Policy Date) is define as a date field in MM/DD/YYYY format.

In my script I'm trying to perform

Month([Policy Date]) as Month

and

Year([Policy Date]) as Year

to no avail.

What do I need to do to extract the month and year from an Excel date field?

1 Solution

Accepted Solutions
Not applicable
Author

hi,

you can use the following code

tab1:

LOAD date#([Policy Date],'MM/DD/YYYY ') as [Policy Date];

LOAD [Policy Date]

from ......abc.xls;

tab2:

load year([Policy Date]) as year,

month([Policy Date]) as month

resident tab1;

hope that it should work

thanks

View solution in original post

3 Replies
Not applicable
Author

hi,

you can use the following code

tab1:

LOAD date#([Policy Date],'MM/DD/YYYY ') as [Policy Date];

LOAD [Policy Date]

from ......abc.xls;

tab2:

load year([Policy Date]) as year,

month([Policy Date]) as month

resident tab1;

hope that it should work

thanks

boorgura
Specialist
Specialist

Richard,

Please try this:

Month(Date([Policy Date]) as Month,

Year(Date([Policy Date]) as Year

Let me know if it works or not.

Not applicable
Author

Thanks Rocky. Did the job.