First off, please use the code formatting as described in:
The DATEPART()
function can actually return week numbers as high as 53.
DATEPART(ww, '2020/01/01')
= 1 (Wed of the 1st week)
DATEPART(ww, '2020/01/05')
returns 2 (Sun of the 1st week)
DATEPART(ww, '2020/12/26')
returns 52 (Saturday of the 52 week)
DATEPART(ww, '2020/12/27')
returns 53 (Sunday of the 53 week)
you need to account for week #53. In your buckets (that use number of weeks relative to current date) Week 53 is the same as week 1 of the following year.