Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Im using the following dax formula to count the day of the year.
DayNoOfYear = DATEDIFF ( DATE ( YEAR ( 'Table'[Date] ), 1, 1 ), 'Table'[Date], DAY ) + 1
Only problem is I have multiple years and I want to have unique value.
How can i add a particular year to this? so that I get for example.
date: 2016-01-01
DayNoOfYear: 1-16
date: 2016-01-31
DayNoOfYear: 31-16
date: 2017-01-31
DayNoOfYear: 31-17
Solved! Go to Solution.
hi @TechR21
try to add a column like:
DayNoOfYear =
VAR _days = DATEDIFF ( DATE ( YEAR ( [Date] ), 1, 1 ), [Date], DAY ) + 1
RETURN _days&"-"&FORMAT([Date], "YY")
hi @TechR21
try to add a column like:
DayNoOfYear =
VAR _days = DATEDIFF ( DATE ( YEAR ( [Date] ), 1, 1 ), [Date], DAY ) + 1
RETURN _days&"-"&FORMAT([Date], "YY")
perfect, thanks!
The simplest way is using "Add column from examples" in Power Query. Something like this:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Is there a reason you're not egetting the day number with the DAY() function?
You could make a calculated column like
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
79 | |
53 | |
39 | |
39 |
User | Count |
---|---|
104 | |
85 | |
47 | |
44 | |
43 |