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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Issue

I have a date field that is formatted YYYY/MM. When I run the Year(Field) As Year I get some screwy number. Is there a formula I should be using to be able to parse the year out? Interestingly enough, the Month(Field) as Month works fine.

Any suggestions?

4 Replies
Miguel_Angel_Baeyens

Hello,

I'd use the following to extract the proper date and year or month from it

Year(Date#(Field, 'YYYY/MM')) AS Year,Month(Date#(Field, 'YYYY/MM')) AS Month


Hope that helps.

IAMDV
Master II
Master II

Quick Solutions : Left(DateColumn,4)

Not applicable
Author

Thank you....is there any additional scripting needed like AS

Miguel_Angel_Baeyens

It is, as I wrote above, the example to be added to your actual script.

Table:LOAD Field, Month(Date#(Field, 'YYYY/MM')) AS Month, Year(Date#(Field, 'YYYY/MM')) AS YearFROM file.qvd (qvd); // your datasource here


Hope that helps