Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I have a "Start date" that has this format: 20-jan-20 1:59:42
I am trying to pull the weeknumber from this with DAX.
Trying to use WEEKNUM but don't get the choice of choosing "Start date".
Tips?
-A-
Solved! Go to Solution.
Hi @Peavey ,
Check the data type of the [Start date] column. The WEEKNUM() function can only accept date type fields as the first parameter.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Peavey ,
Check the data type of the [Start date] column. The WEEKNUM() function can only accept date type fields as the first parameter.
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
My tip? Don't do it this way.
I assume you don't have a calendar table. You should get one of those. https://exceleratorbi.com.au/power-bi-calendar-tables/
Then split the column you have in your current table into a date column and a time column.
join the new date column to the calendar table.
use power query to add the weeknumber column you need into the calendar.
use the calendar table weeknumber as needed.
@Peavey , Is format is datetime?
Or try like
new column =
var _Date = date(year([Start date]),month([Start date]),day([Start date]))
return
weeknum(_date)
also check
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |