Forum Discussion

sw123's avatar
sw123
Helper III
4 years ago
Solved

Problems with week number

Hi,

 

I have a date table with a week year column like this:

 

"Week year", YEAR([Date]) & " "& WEEKNUM([Date], 21)
 
In our calender (ISO 8601) Januari 1st and 2nd 2022 is part of week 52 2021. My date calender sets Januari 1st and 2nd to week 52 2022, which is of course totally wrong. How can I fix this?
 
Thanx in advance!
  • Hi sw123 ,

     

    Try this:-

    Column =
    VAR week_num =
        1+ INT (
                DIVIDE (
                    (
                        [Date] - WEEKDAY ( [Date], 16 ) + 1
                    )
                        - ( DATE ( YEAR ( [Date] ), 1, 1 ) ),
                    7
                )
            )
    RETURN
        "Week year " & YEAR ( [Date] ) & " " & week_num

     

    Thanks,

    Samarth

2 Replies