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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
97 | |
80 | |
69 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |