How to get "last week" when "this week" is the first week of January?

Usually, to determine unique week I do year(date)*100+weeknum(date) so, last week of December 2021 would have the value 202152. and the first week of January 2022 would be 202201.

The system works really well unless I’m looking to get “last week’s” value. I can’t simply do thisWeek-1 (202201 - 1 = 202200 not 202152).

Any ideas?

(date) → (date - 7)?

3 Likes

That works…I’ll need to reverse my math logic (calculate -7 THEN determine week) but that seems the most straightforward solution.

Thanks!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.