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

**URL:** <https://community.glideapps.com/t/how-to-get-last-week-when-this-week-is-the-first-week-of-january/36694>\
**Category:** Ask for Help\
**Created:** [January 4, 2022, 8:47pm UTC](https://community.glideapps.com/t/how-to-get-last-week-when-this-week-is-the-first-week-of-january/36694 "2022-01-04T20:47:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 4, 2022, 8:47pm UTC](https://community.glideapps.com/t/how-to-get-last-week-when-this-week-is-the-first-week-of-january/36694/1 "2022-01-04T20:47:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Darren\_Alderman](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_alderman/32/66660_2.png) [@Darren\_Alderman](https://community.glideapps.com/u/Darren_Alderman)\
**Post date:** [January 4, 2022, 8:56pm UTC](https://community.glideapps.com/t/how-to-get-last-week-when-this-week-is-the-first-week-of-january/36694/2 "2022-01-04T20:56:16Z")

</div>

(date) → (date - 7)?

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [January 4, 2022, 9:17pm UTC](https://community.glideapps.com/t/how-to-get-last-week-when-this-week-is-the-first-week-of-january/36694/3 "2022-01-04T21:17:01Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [January 5, 2022, 9:17pm UTC](https://community.glideapps.com/t/how-to-get-last-week-when-this-week-is-the-first-week-of-january/36694/4 "2022-01-05T21:17:50Z")

</div>

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