I am not quite sure what you want to do with this function, but I think these 2 things can help you:
Lag function: Get value from earlier row or next row.
You can also use this in combination with if-function, for instance:
if (week = lag(week)) -> if the value of week in this row is similar to that in the previous row.
aggregate - first : Give a variable the same value as the first one (first sort cases, then have break on week, then it gets the value of the first value for that week).