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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ivanajoh
Frequent Visitor

DAX Weeknum ISO 8601 Wrong

Hi guys,

I have a column with DAX use =WEEKNUM([Dates], 21). What i need is the first week of a year will start in first monday. And the DAX works fine for year 2021 and 2022

ivanajoh_3-1645780700886.png

But in 2020 and beyond. January 1 which is week 1 of the month, not the first Monday. in 2020, week 1 is supposed to start on january 6th but Weeknum in dax counts from the 1st. does anyone know why?

ivanajoh_4-1645780899324.png

 

 

Thank you

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@ivanajoh , if that is not as per standard. Then you can log an issue or idea.

 

or You can develop some custom logic.

 

like if(year([Date]) =2020 , <> , <> )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

The ISO 8601 definition for week 01 of an year is the week with the first Thursday of the year and starts with Monday.

For 2022 and 2021 we see that the week starting from 3rd and 4th January respectively satisfy these conditions.

Aditya_Meshram_0-1645785628774.pngAditya_Meshram_1-1645785635425.png

But  for 2020 and 2019
we see that the first Thursday is contained in the week beginning from 1st January. Hence the first week for these years begins from last year December. And 1st January is included in that week 1, hence week 1 for those years begins from 1st January.

Aditya_Meshram_2-1645786922676.pngAditya_Meshram_3-1645786926798.png

For the year 2020⬇️

Aditya_Meshram_4-1645787102178.png

For the year 2019⬇️

Aditya_Meshram_5-1645787204897.png

Hence the results you are getting are correct. Hope this helps.

Regards,

Aditya

 

 

View solution in original post

3 REPLIES 3
ivanajoh
Frequent Visitor

@amitchandak @Anonymous Thank You for the help and the explanation

Anonymous
Not applicable

The ISO 8601 definition for week 01 of an year is the week with the first Thursday of the year and starts with Monday.

For 2022 and 2021 we see that the week starting from 3rd and 4th January respectively satisfy these conditions.

Aditya_Meshram_0-1645785628774.pngAditya_Meshram_1-1645785635425.png

But  for 2020 and 2019
we see that the first Thursday is contained in the week beginning from 1st January. Hence the first week for these years begins from last year December. And 1st January is included in that week 1, hence week 1 for those years begins from 1st January.

Aditya_Meshram_2-1645786922676.pngAditya_Meshram_3-1645786926798.png

For the year 2020⬇️

Aditya_Meshram_4-1645787102178.png

For the year 2019⬇️

Aditya_Meshram_5-1645787204897.png

Hence the results you are getting are correct. Hope this helps.

Regards,

Aditya

 

 

amitchandak
Super User
Super User

@ivanajoh , if that is not as per standard. Then you can log an issue or idea.

 

or You can develop some custom logic.

 

like if(year([Date]) =2020 , <> , <> )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.