Forum Discussion

android1's avatar
android1
Post Patron
10 years ago
Solved

WeekNum out by a few

Hi,   Any idea why the column Week No = WEEKNUM(AVS[ServiceDate]) is wrong by 1 or 2 weeks? For Week 29 of this year, 18th July - 24th July its returning 30 for 18th-23rd & 31 for the 24th.  ...
  • KGrice's avatar
    KGrice
    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!