Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
narband2778
Creator II
Creator II

A Small doubt in dates function (might be silly) but it's confusing me

Hi Guys,

the below two functions returns the same date if I use today()

=YearEnd(today(),0,-10)

returns: 31/01/2014

=YearEnd(today(),0,2)

returns: 31/01/2014

what's the difference ?

Thanks,

Naresh

3 Replies
Nicole-Smith

The third parameter of YearEnd() is "first month of year".

So when you have 2, 2=February since your second parameter ("shift") is zero.

And when you have -10, 12-10=2=February as well, since, once again, your second parameter ("shift") is zero.

narband2778
Creator II
Creator II
Author

Thanks for your response.

but, instead of using today() function if pass valid date.

Ex:  =YearEnd('01/02/2000',0,-10)

result: 31/01/2000

YearEnd('01/02/2000',0,2)

result: 31/01/2001


why these are showing different results?

anyone??

Nicole-Smith

For YearEnd('01/02/2000',0,-10), it shows the end of the previous year (because the 10 is negative).  Since you say the new year starts in February, the end of the previous year would be 31/01/2000 (because 01/02/2000 is the first day of the new/"current" year).


For YearEnd('01/02/2000',0,2), it shows the end of the "current" year (because the 2 is positive).  Since you say the new year starts in February, the end of the current year would be 31/01/2001 (because 01/02/2000 is the first day of the new/"current" year).