Forum Discussion
WeekNum out by a few
- 10 years ago
It looks like Power BI counts the first week of the year starting on 1/1/2016, rather than including it in part of the last week of the prior year.
That goes against many standard calendars, specifically the ISO definition.
I'm not sure why MS uses a different system, but knowing when they start, you could subtract one from your formula and get the result you wanted.
This is also the default behavior in Excel, unless you use =WEEKNUM(DateCell, 21). In Power BI, there is no option for this. You can vote on the idea here to make that happen.
EDIT: other posters mentioned after this was accepted as a solution that you can use WEEKNUM([DateColumn], 21) in Power BI, it's just not documented and doesn't show up as a standard option while writing the formula. Thanks for pointing this out!
I'm having a hard time understanding from your question which date you feel is getting back a bad weeknum. I can not repro this issue. Are you being thrown off by the Leap Year in 2016?
Hi,
Isn't 18th - 24th July 2016 Week Number 29? I was expecting WeekNum to return 29 for these dates. Instead it returns 30 & 31.
- KGrice10 years agoMemorable Member
It looks like Power BI counts the first week of the year starting on 1/1/2016, rather than including it in part of the last week of the prior year.
That goes against many standard calendars, specifically the ISO definition.
I'm not sure why MS uses a different system, but knowing when they start, you could subtract one from your formula and get the result you wanted.
This is also the default behavior in Excel, unless you use =WEEKNUM(DateCell, 21). In Power BI, there is no option for this. You can vote on the idea here to make that happen.
EDIT: other posters mentioned after this was accepted as a solution that you can use WEEKNUM([DateColumn], 21) in Power BI, it's just not documented and doesn't show up as a standard option while writing the formula. Thanks for pointing this out!
- Anonymous10 years agoNot applicable
Weeks start on Sunday, and July 17 starts the 30th week. Note that Jan 1 - Jan 2 is considered "Week 1", with Week 2 starting Jan 3.
- android110 years agoPost Patron
Hi,
This returns the correct WeekNum -> Week No = WEEKNUM(AVS[ServiceDate],21)
Thanks for the replies.