Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to make my year field return last 2 digit ?

Hi All

Now my year field as below :-

  year([date]) as [year],

it generate 2009 2010 2011 2012

How to make it display as 09 10 11 12 ?

Now i am using below script at list box, which is not a good approach :-

=

IF(year='2014','14',

IF(year='2013','13',

IF(year= '1997' ,'97',

IF(year= '1998' ,'98',

IF(year= '1999' ,'99',

IF(year= '2000' ,'00',

IF(year= '2001' ,'01',

IF(year= '2002' ,'02',

IF(year= '2003' ,'03',

IF(year= '2004' ,'04',

IF(year= '2005' ,'05',

IF(year= '2006' ,'06',

IF(year= '2007' ,'07',

IF(year= '2008' ,'08',

IF(year= '2009' ,'09',

IF(year= '2011' ,'11',

IF(year= '2012' ,'12',

IF(year= '2010','10'))))))))))))))))))

Paul

9 Replies
Not applicable
Author

Right(Year, 2)

Not applicable
Author

Hi Paul,

Simple use

=right(Year,2)

Not applicable
Author

Hi Sir

Thank you for reply , my org code :-

year([date])as [year],

I try to replace with below cannot work :-

right(year,2([date]))as [year_],

Any advise ?

Not applicable
Author

Hi Sir

work now. Thank

Right(year(date),2)            as [year_],
bill_mtc
Partner - Creator
Partner - Creator

Hi Paul,

To Remain the format of Year as Year, you can use the Date() function, see below:

Date(DateTrans, 'YY') as Year_in_Two_Digits

Also, see attached file for your reference! Thank you.

Regards,

Bill

Not applicable
Author

Hi Bill

Now i face another issue which is not able to sort from 96 99 10 in sequences.

See my new post :-

http://community.qlik.com/message/429035#429035

bill_mtc
Partner - Creator
Partner - Creator

Did you apply the one I suggested? If yes, I guess, you can now sort it respectively Paul.

Not applicable
Author

Hi Paul

PFA Hope it is helpful

Sokkorn
Master
Master

Hi Mr. Paul,

I know that you found solution on this. But I would recommend you to use function below:

Date(YearStart([DateField]),'YY')

Regards,

Sokkorn