Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Wrong day of year

Hi

Trying to figure out why I get the wrong day of year.

I have a text box where I put this: =DayNumberOfYear(Start)

Start is a date ield that contains the start date for a production batch. It would typically look like: 14.12.2011 12:00:00

I have tried it with the Now() and Today() function as well.

= 'dayYTD: ' & DayNumberOfYear(Now())

Given todaysdate: 20.12.2011 it should return 354, but it return 355.

Can any one please ket me in on why?

Dan

7 Replies
swuehl
MVP
MVP

DayNumber of year always uses years based on 366 days, so a specific day of month always gets the same number assigned.

Try:

=Today()- yearstart(Today()) +1

edit

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Dan,

I get 355 with Now(), look at your systemdate.

Greetings from Munich

Martina

EVACO GmbH

Anonymous
Not applicable
Author

Martina: I also get 355, but it should show 354. At least according to my calendar.

Dan

Anonymous
Not applicable
Author

Swuehl: It get 354 with your code yes, but how to use it if I have a field with date.

Like my start date. I want to get the correct day of year for that given date.

Dan

jagan
Luminary Alumni
Luminary Alumni

Hi,

I think Qlikview is calculating 29 Days for February.  That is what Swuehl said, if you want exact days use the above expression suggested by Swuehl.

Regards,

Jagan.

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, Dan-Ketil,

you can use in the expression a datefield with the Num-function:

=Num(Datefield)-yearstart(Datefield) +1

Greetings from Munich

Martina

EVACO GmbH

jagan
Luminary Alumni
Luminary Alumni

Try using this

=DateFieldName- yearstart(DateFieldName) +1

Regards,

Jagan.