## Desktop

Frequent Visitor
Posts: 13
Registered: ‎07-21-2016

# Day number of year

Hello Forum,

I am looking for the simplest way of creating a measure that just returns day number of the year, ie 2017-04-03 would return 93.

Note: Not trying to create a calculated column.

thx,

Peter

Super Contributor
Posts: 2,020
Registered: ‎08-11-2015

## Re: Day number of year

@Peterwis

`Day Of Year Measure = DATEDIFF(DATE(YEAR(TODAY()), 1,1), TODAY(), DAY) + 1`

Super User
Posts: 7,180
Registered: ‎07-11-2015

## Re: Day number of year

Perhaps something like this:

`Measure = (YEARFRAC("Jan 1 2017",TODAY())*360)+1`

Proud to be a Datanaut!

Frequent Visitor
Posts: 13
Registered: ‎07-21-2016

## Re: Day number of year

thx, this seems to work, how can I make the year to be the current year automatically

Frequent Visitor
Posts: 13
Registered: ‎07-21-2016

## Re: Day number of year

thx, this seems to work, how can I make the year to be the current year automatically

Super Contributor
Posts: 2,020
Registered: ‎08-11-2015

## Re: Day number of year

[ Edited ]

My Measure takes care of this

Frequent Visitor
Posts: 13
Registered: ‎07-21-2016

## Re: Day number of year

Thx Sean, this syntax does not seem to work for me

Super Contributor
Posts: 2,020
Registered: ‎08-11-2015

## Re: Day number of year

`Day Of Year Measure 2 =  ( YEARFRAC ( DATE ( YEAR ( TODAY() ), 1,1 ),TODAY() )*360 ) + 1 `
Frequent Visitor
Posts: 13
Registered: ‎07-21-2016

## Re: Day number of year

Yes, I tried yours first for that reason :-) I will expand on what I am trying to achieve. I have a table with monthly targets.

Jan (20), Feb (25), March (20), April (50), etc

I would like to create a measure that gives me the YTD target per a specific date such as April 5. What is the smartest way of doing that?

thx

Frequent Visitor
Posts: 13
Registered: ‎07-21-2016

## Re: Day number of year

Thx Sean, cannot get this to work either. What am I missing?