I use PowerBI primarly with CRM Dynamics 365. I just like the multitude of options it gives you in creating reports and graphs for users compared to the out of the box functionality in CRM Dynamics.
There's even a build in integration with it, so it's like Microsoft is practically begging me to use it.
I make a lot of reports that contain weeknumbers, like for example the amount of activities completed for each week. However PowerBI doesn't care where you are from, by default it applies the US definition of how weeknumbers are defined.
I'm from the EU, where ISO 8601 is being used and because of this alot of my users report that their activities are in the wrong week.
In the US, the first week is considered to be the first day of whenever 1 january starts.
So if your calendar looks like this in December:
Mo | Tue | Wed | Thu | Fri | Sat | Sun |
29 | 30 | 31 | 1 | 2 | 3 |
4 |
Then week 1 starts on Thursday in the US. In the EU and by ISO 8601 standards this is still considered week 53 and week 1 starts next week.
To fix this, I used Power Query M with the following lines in a new custom column
if
Number.RoundDown((Date.DayOfYear([createdon])-(Date.DayOfWeek([createdon], Day.Monday)+1)+10)/7)=0
then
Number.RoundDown((Date.DayOfYear(#date(Date.Year([createdon])-1,12,31))-(Date.DayOfWeek(#date(Date.Year([createdon])-1,12,31), Day.Monday)+1)+10)/7)
else if
(Number.RoundDown((Date.DayOfYear([createdon])-(Date.DayOfWeek([createdon], Day.Monday)+1)+10)/7)=53 and (Date.DayOfWeek(#date(Date.Year([createdon]),12,31), Day.Monday)+1<4))
then
1
else
Number.RoundDown((Date.DayOfYear([createdon])-(Date.DayOfWeek([createdon], Day.Monday)+1)+10)/7)
In my case, the column used to calculate the weeknumber is called createdon.