Showing results for 
Search instead for 
Did you mean: 

Date of Year

Super User IV
Super User IV
Super User IV

Date of Year

Sure, you can figure out the day of the year by using a simple formula like:



DayOfYear = DATEDIFF(DATE(YEAR([Date]),1,1),[Date],DAY) + 1


But, how do you take a day of year and convert it to the date of the year?


DateOfYear = 
VAR __Year = INT(MAX(Years[Year]))
VAR __DayOfYear = INT(MAX(DaysOfYear[DayOfYear]))
VAR __tmpTable = ADDCOLUMNS(GENERATESERIES(DATE(__Year,1,1),DATE(__Year,12,31),1),"__DayOfYear",DATEDIFF(DATE(__Year,1,1),[Value],DAY)+1)
VAR __DateofYear = MAXX(FILTER(__tmpTable,[__DayOfYear]=__DayOfYear),[Value])
RETURN IF(ISBLANK(__DateofYear),BLANK(),FORMAT(__DateofYear,"mm/dd/yyyy"))

That's how.






Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!