Forum Discussion
Weeknum wrong
Not entirely sure what to do or how to interpret your answer.
It is DAX code messing up in my opinion, as you stated, its starting a new week with a new year. Regardless the fact that you state a week should start on sunday or monday. What is the point of that argument then in this case?
decarsul , You can log an issue or Idea
Issue - https://community.powerbi.com/t5/Issues/idb-p/Issues
Idea - https://ideas.powerbi.com/ideas/
As of now, you can create your own column
//Monday Week start
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
//Sunday Week Start
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],1)
min week start of year = minx(filter('Date',year([Week Start date])=earlier(year(Week Start date]))),[Week Start date])
week No = quotient(datediff([min week start of year],[date],day),7)+1
- decarsul5 years agoHelper V
Thanks for the suggestion.
However, i've reverted and am still testing to Weeknum(date,21).
So far, this seems to be working. With the exception that week 53 of year 2021 is at the end of each visual, instead of the start.
- Payeras_BI5 years agoSolution Sage
Hi decarsul ,
When you say "week 53 of year 2021 is at the end of each visual, instead of the start", I think you mean the first three days of 2021 belonging to week 53 of year 2020.
If this is the case you can get them at the top of your visual tagging them as 2020 instead and sorting by Year Week (2020-53 would come first than 2021-01).
ISO Week number:
ISO Year:
Regards,