Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to convert a timestamp column in Year YYYY format?

Hi,

I tried using the YEAR() function but I am not getting any records.

I imported an excel file in my qlikview and I wanted to extract year from a timestamp column, but I am unbale to do so.

What could be the error?

PFA screenshot

I want to Year from the ORDERED DATE list box,

for example

2014

2015

2016

Thanks

10 Replies
Anil_Babu_Samineni

This either in Script / Listbox Expression ..

=Date(Date#([ORDERED DATE],'DD/MM/YY hh:mm TT'),'YYYY')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Try like:

Year(Date#([Ordered Date], 'DD/MM/YY hh:mm TT'))

its_anandrjs

This one

Year( Date(Date#([Ordered Date], 'DD/MM/YY hh:mm TT'),'YYYY') )

Anonymous
Not applicable
Author

Perfect, Thanks

But now I want distinct year in the list box, how do I get that?

Anonymous
Not applicable
Author

Thanks, even this worked. But I want distinct values in listbox.

Anil_Babu_Samineni

For Distinct May be this?

In script

Load Distinct Date(Date#([ORDERED DATE],'DD/MM/YY hh:mm TT'),'YYYY') as DateFieldName;


In Listbox, Try this? and give it caption as business

Aggr(Date(Date#([ORDERED DATE],'DD/MM/YY hh:mm TT'),'YYYY'), [ORDERED DATE])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Using year() as I showed above should give distinct values in list box. Could share a sample qvw.

Anonymous
Not applicable
Author

Hey, it worked when applied in script...got distinct year! Thanks a lot.

its_anandrjs

Can you close the thread now with appropriate answers correct / Helpful or references.