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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Derive the Year

Hello

I have a period Name field that has values as Mar-14 where 14 stands for the the year.

If I want to derive the year from this field using the year function something like YearName([Period Name]=2014

What is the best way to achieve it?

Labels (1)
3 Replies
robert_mika

Try

=YEAR(Date#('Mar-14 ','MMM-YY'))

or in script

=YEAR(Date#(Name,'MMM-YY')) as Year

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If the period is a string you can do:

num(subfield(Period, '-', 2)) as Year

If the period was loaded as a Date, you can do:

Year(Period) as Year

-Rob

Not applicable
Author

Hi,

You can try this.

In Script.

Date(Date#(Year_Field_Name,'MMM-YY'),'YYYY')      as  Extract_Year,