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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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 , <> , <> )

View solution in original post

Aditya_Meshram
Solution Supplier
Solution Supplier

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 @Aditya_Meshram Thank You for the help and the explanation

Aditya_Meshram
Solution Supplier
Solution Supplier

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 , <> , <> )

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors