Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

How to fix calendar table for ISO week number reset every year

Hello,

 

I have the following calendar table. The aim is to get the correct ISO week number 8601 format, so the week start is always on Monday and the end of the week is always on the following Sunday.  The WeekSequenceNum column is correct according to the dates, with the calendar starting from 1 January 2020. But i would like to have a reset when the year changes but it should still be in line with the ISO 8601 format, where the first week of the year should be the one with the Thursday included, or any other rule that is applicable to get the ISO 8601 week number format. The problem in this case is that the week number does not follow correctly at the start of the year 2021 and 2022. 

 

For example, as below, the WeekSequenceNum (resets each year) should be 1 as from 4 January 2021. From 1 January 2021 until 3 January 2021, the WeekSequenceNum (resets each year) should be 53. In Power Query, the problem is the calculated value in the column "MinWeekSequenceNum" which is based off of the year dates but the start of each year 2021, 2022, etc does not correspond exactly to the first week number. So, i'm not sure how to approach or solve this problem in Power Query.

MakeItReal_0-1647800879677.png

 

Here is the PBIX file: https://drive.google.com/file/d/1rmREtki6DVAF22t4zqeBXrq8wH6Wd6g3/view?usp=sharing

(click on the Download icon at the top right corner of the window - please let me know if there is a better way to share the file)

Any help is much appreciated!!

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous WEEKNUM([Date], 21)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous WEEKNUM([Date], 21)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler Thanks for the alternate solution! I created a calculated column and used the formula. It works!

 

But on a side note, i was hoping to resolve this entirely through Power Query. Is that possible?

@Anonymous It is but not pretty, there is no native ISO week in Power Query:

ISO Week in Power Query / M language and Power BI | Excel Inside (excel-inside.pro)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors