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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
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

Labels (1)
3 Replies
Nicole-Smith
MVP
MVP

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
MVP
MVP

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).