The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I'm trying to generate a value that shows the current day number of the calendar year. For instance, today is January 15, and I would like the measure to display the number 15. I'd like for this to auto-update each day, so for January 16, it displays 16 and so on.
Is there a way to do this without creating a calculated column?
Purpose: what I am trying to do is breakdown an annual goal into a YTD goal (i.e. if the 2018 goal is to create 1,000 widgets, then by the 15th day of the year, we should have created 41 widgets -- (1,000 / 365) * DayofYear (15) = 41.
Thanks,
Solved! Go to Solution.
Hi @MAkiva1,
The second parameter can be today().
Measure 4 = DATEDIFF ( DATE ( 2018, 1, 1 ), TODAY (), DAY )
It's accurate if you use it locally. One possible effect is the time lag. But usually it won't be a problem.
Best Regards,
Dale
The answer is much simpler but requires 2 columns
First the Equation then the Explination
Col1 CurrentYearStartDate ="01/01/"&FORMAT(tbl_Date[Date],"YYYY") ---formatting ribon Data Type [Date] Format [dd/mm/yyyy]
Col2 YearDateNu = tbl_Date[Date]-tbl_Date[DayNu]+1 ---formatting ribon Data Type [Decimal Number] Format [General]
Explination
Might be a bit of a long way of doing it but the result is 100%, please check and let me know
Hey Folks -
I was looking for a solution to the same issues as the OP presented, and stumbled across this post.
I did not like the fact the solution was to hard code the year 2018 - As I wanted this to be added to my DateTable.
A solution I formed by slightly modifying the solution within this post was the following -
DayNum of Year =
DATEDIFF( DATE( YEAR(dDateTable[Date]),1,1), dDateTable[Date] , DAY ) + 1
Replace dDateTable[Date] with your date column within your date table. Now you should be able to compare YoY by Day of Year dynamically.
I've found a potential solution, but don't know if it will produce accurate results (morning vs afternoon):
DayofYear = DATEDIFF(DATE(2018,1,1),DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())),DAY)
Any suggestions?
Hi @MAkiva1,
The second parameter can be today().
Measure 4 = DATEDIFF ( DATE ( 2018, 1, 1 ), TODAY (), DAY )
It's accurate if you use it locally. One possible effect is the time lag. But usually it won't be a problem.
Best Regards,
Dale
Hi @MAkiva1,
Could you please mark the proper answer as solution?
Best Regards,
Dale