Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Substring the date to select only year

Hello all,

I'm very new to Qlikview and need your help to extract only a year from the date.

My source data is simple excel. Order date in the format mm/dd/yyyy. I'm using below Subfield function to extract only year from order date and ship date. When I reload the data and preview the table, it doesnt show any year in loaded table preview.

Please help me if I'm missing anything here. Thanks in advance. Below is the SQL im trying to load.

Please let me know if any addition info required.

NoConcatenate LOAD [Row ID],

     [Order ID],

     [Order Date],

     SubField([Order Date],'/',3) AS Saleyear,

     [Ship Date],

     SubField([Ship Date],'/',3) AS Shipmentyear,

     [Ship Mode],

..

FROM

3 Replies
Not applicable
Author

You can use the below in script

LOAD [Row ID],

     [Order ID],

     [Order Date],

Year([Order Date]) as Year,

Month([Order Date]) as Month,

[Ship Date],

Year([Ship Date]) as Year,

Month([Ship Date]) as Month,

like this you can derive

sunny_talwar

First thing to check would be to see if [Order Date] and [Ship Date] are read correctly by QlikView. To learn how to check this look here:

Why don’t my dates work?

Get the Dates Right

Once the dates are read correctly, simply use the Year() function to extract date from your Date fields (just like pointed out by arumamahesh‌)

Not applicable
Author

Excellent.It worked. Thanks Umamaheshwara and Sunny