SOLVED

Is there any replacement for WEEKNUM in Power BI

Brass Contributor

Is there any way to find the Week Number from a Date field using a custom column in POWER BI desktop app

5 Replies
Rashid, didn't catch, replacement of what? WEEKNUM in DAX works fine, or you mean Power Query? Here is also some function.
I am trying to get the WEEKNUM from a date column by adding a custom column in power BI. "WEEKNUM([Date],2)" gives me an error in Power BI "Expression error: The name 'WEEKNUM' wasn't recognized. Make sure it's spelled correctly."

When I Go Edit Query Mode add a custom column and add the formula =WEEKNUM(Date,1) it gives me an error but It all works fine If I add the column directly from Report page. 

best response confirmed by Rashid Mohammed (Brass Contributor)
Solution

These are different tools, with Query you use M language and with model DAX. Check query function here https://msdn.microsoft.com/en-us/library/mt253480.aspx .

 

In the Query Editor, select the date column. Go to the Add column tab. Under the Date button on the right side of the ribbon, select Week, then week of the year. That's the week number equivalent.
1 best response

Accepted Solutions
best response confirmed by Rashid Mohammed (Brass Contributor)
Solution

These are different tools, with Query you use M language and with model DAX. Check query function here https://msdn.microsoft.com/en-us/library/mt253480.aspx .

 

View solution in original post