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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JonathanJohns
Helper III
Helper III

Transform a date to a day of the year

Good morning,

 

I've got a question about a transformation of the date. 

 

I would like to do this operation :

 

DateDay
01/01/20171
02/01/20172
03/01/20173
04/01/20174
05/01/20175
------------
------------
01/01/20181
02/01/20182
03/01/20183
04/01/20184
05/01/20185

 

I tried to use the function Day but this one works only for day in month and not for a year. Do you have any idea to do it please ?

 

Thank you for your anwer.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

It can be done in the query editor. Open the table that contains date field in query edition and right click on the field that has dates and select " Add columns from Example". A new column will be added, then double click on a cell in the new column you will see a drop down as below-select the circled option "Day of Year"

 

Untitled.png

View solution in original post

3 REPLIES 3
jthomson
Solution Sage
Solution Sage

If you're not wanting to use Power Query, then it'd also be possible to use DAX with something like:

 

DayofYear = DATEDIFF(DATE((YEAR[yourdatecolumn]-1),12,31),[yourdatecolumn],DAY)

 

which'll count the number of days between the last day of the previous year and the date in question

Anonymous
Not applicable

It can be done in the query editor. Open the table that contains date field in query edition and right click on the field that has dates and select " Add columns from Example". A new column will be added, then double click on a cell in the new column you will see a drop down as below-select the circled option "Day of Year"

 

Untitled.png

It works perfectly thank you ! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.