Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

DayNumberOfYear

I want to use the DayNumberOfYear function for making expression calculating the number of days until someone has a birthday. In order to make the calculation work properly I also need to check whether the current year, and the year the person was born in was a leap year. I have however found that using DayNumberOfYear(YearStart()) with any years other than the current one will return 366, shouldn't this return 1? I have also found that using DayNumberOfYear(YearEnd()) is always 365 regardless of whether the date I put in is a date in a leap year or not.

3 Replies
qlikconsultant
Creator III
Creator III

DayNumberOfYear: Returns the day number of the year according to a timestamp with the first millisecond of the first day of the year containing date. The function always uses years based on 366 days.

Strange logic from the QlikView Developers.

Anonymous
Not applicable
Author

Not applicable
Author

Hi Dargun,

I know this is late in the day but I've just had to do something similar relating to Day of Year.

To work out the leap year you could take advantage of the Mod function

IF(Mod(Year(DateEntered),4) = 0 , 'Leap Year', 'Not Leap Year')

though to be really accurate you'd have to add a bit to ignore when  Mod Year 100 = 0 unless Mod Year 400 = 0 but that is maybe forecasting a bit too far into the future depending on the app