Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello.
I am quite new to Power BI and I have leveraged a lot of knowledge from this forum so far but now I need help from you guys if possible.
I am currently experiencing a problem where Power BI does not show correct week numbers since we switched from the year 2020 to 2021. This is the current behaviour that I get in terms of week numbers:
W01 - starts on 01/01/2021
W02 - starts on 04/01/2021
W03 - starts on 11/01/2021
...
While it should be like the following:
W01 - starts on 04/01/2021
W02 - starts on 11/01/2021
W03 - starts on 18/01/2021
...
Since I am working a lot with relative weeks/months/quarters when visualising things, this is the formula that is used to calculalculate the week number:
= Table.AddColumn( #"Added rDate", "Week", each " W" & Text.PadStart( Number.ToText( Date.WeekOfYear( [Date] ) ), 2, "0" ), type text )
EDIT: My first day of the week is Monday.
Can someone please help me solve this problem? Thank you!
Solved! Go to Solution.
I managed to get this working by following this tutorial:
http://datacornering.com/how-to-calculate-iso-week-number-in-power-query/
I managed to get this working by following this tutorial:
http://datacornering.com/how-to-calculate-iso-week-number-in-power-query/
Hi, check this:
CalendarWeek = ROUNDDOWN(([DateKey]-DATE(year([DateKey]-WEEKDAY([DateKey]-1)+4),1,3)+WEEKDAY(DATE(YEAR([DateKey]-WEEKDAY([DateKey]-1)+4),1,3))+5)/7,0)
Source:
https://powerbiuniversity.com/calendario-completo-dax/
@n5722 change the M code from Day.Sunday to Day.Monday
Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
For 2020 everything was ok. The issue is with the transition towards 2021 where the first 3 days of 2021 should still be part of W53 of 2020 while W01 2021 should start on 04/01
@n5722 what is your first day of week, read this documentation.
= Table.AddColumn( #"Added rDate", "Week", each " W" & Text.PadStart( Number.ToText( Date.WeekOfYear( [Date], Day.Sunday ) ), 2, "0" ), type text )
Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
User | Count |
---|---|
93 | |
84 | |
78 | |
75 | |
66 |
User | Count |
---|---|
115 | |
105 | |
93 | |
65 | |
60 |