Forum Discussion

ivanajoh's avatar
ivanajoh
Frequent Visitor
4 years ago
Solved

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

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?

 

 

Thank you

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

  • Anonymous's avatar
    Anonymous
    4 years ago

    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.

    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.

    For the year 2020⬇️

    For the year 2019⬇️

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

    Regards,

    Aditya

     

     

3 Replies

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

  • Anonymous's avatar
    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.

    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.

    For the year 2020⬇️

    For the year 2019⬇️

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

    Regards,

    Aditya