• However, the fix is really simple. Since all we need in an anchor date of a monday, write this case statement.

    --===== Test the new formula ============================================================

    DECLARE @Bitbucket INT;

    SELECT @Bitbucket = CASE

    WHEN Date < '19000101' THEN DATEPART(dy,DATEDIFF(dd,'17530101',Date)/7*7+3)+6

    ELSE DATEPART(dy,DATEDIFF(dd,'19000101',Date)/7*7+3)+6

    end / 7

    FROM #TestTable;

    GO 5


    N 56°04'39.16"
    E 12°55'05.25"