# Week Number math issue

**URL:** <https://community.glideapps.com/t/week-number-math-issue/62466>\
**Category:** Ask for Help\
**Created:** [June 5, 2023, 4:10pm UTC](https://community.glideapps.com/t/week-number-math-issue/62466 "2023-06-05T16:10:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [June 5, 2023, 4:10pm UTC](https://community.glideapps.com/t/week-number-math-issue/62466/1 "2023-06-05T16:10:53Z")

</div>

I spoke a little too soon, on this @Darren_Murphy . What I want to be able to do is use the week number column as the “now” so that it is confirming for me that the week number calculated by Weeknum(now) corresponds to the date of this week. How would I modify your formula to do that? My attempts result in a number rather than a date.  
Continuing the discussion from [Convert WeekNum to "Week of XXX"](https://community.glideapps.com/t/convert-weeknum-to-week-of-xxx/62372/2):

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [June 6, 2023, 12:02am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/2 "2023-06-06T00:02:45Z")

</div>

So you have a table where you store logs of something, and you want to confirm if the logs are falling into “this week” or not?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 6, 2023, 2:18am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/3 "2023-06-06T02:18:01Z")

</div>

> [@BLA\_68](#):
>
> What I want to be able to do is use the week number column as the “now” so that it is confirming for me that the week number calculated by Weeknum(now) corresponds to the date of this week.

um, if that’s the case why not just do `Weeknum(Now)`, and then do a direct comparison? 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [June 6, 2023, 2:53am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/4 "2023-06-06T02:53:54Z")

</div>

@ThinhDinh, yes basically. And fair point @Darren_Murphy …I’m realizing that I didn’t totally explain the set up in the first post.

So I have a variable (“X”) that increments the week number up or down:

Weeknum(Now)+X. As I or other admins click the button, I want it to confirm the week using the calendar date, so if you were going up, each time you clicked the button it would go:

Week of June 5th, 2023  
Week of June 12th, 2023

Etc.

Edit: Meanwhile the Weeknum(Now)+X column is being used in a query of documents that have different dates and displaying them in a collection based on the week that they were created. So each time one clicks the button, the document list changes. A version of this list is then emailed to the client, so the goal is to make sure you’re emailing documents for the right week.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [June 6, 2023, 3:24am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/5 "2023-06-06T03:24:15Z")

</div>

> [@BLA\_68](#):
>
> So I have a variable (“X”) that increments the week number up or down:

Does that start at zero for now, or are you calculating the actual week number of the year based on the current date?

If I’m understanding your use case correctly, I think I’d be more inclined to work with raw dates rather than messing around trying to convert between dates and week numbers. So instead of incrementing by 1, increment by 7 each time you click the button.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [June 6, 2023, 3:32am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/6 "2023-06-06T03:32:04Z")

</div>

I see your thinking. But the dates of the documents may be one of seven dates within a given week and I’m trying to group documents by week. So in Table 1, I was using WeekNum(date) to see first which week the documents were created in. And then in Table 2 I have a column “whichWeek” which is the math column with the WeekNum(Now)+X formula. And then in the query I’m asking "Show me all the documents created in the week that meets the Which Week value. "

But so the button is changing the “whichWeek” column value but I want that to display on the front in not as “23” but “week of June 5”

---

<div class="post-metadata">

**Author:** ![Structure\_Art\_DIGITA](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/structure_art_digita/32/59811_2.png) [@Structure\_Art\_DIGITA](https://community.glideapps.com/u/Structure_Art_DIGITA)\
**Post date:** [June 6, 2023, 3:37am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/7 "2023-06-06T03:37:16Z")

</div>

You can calculate the first day of the current week… then you will get all the first days using Darren’s suggestion… this technique is better because it will give you all years… not just the current one.

---

<div class="post-metadata">

**Author:** ![BLA\_68](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@BLA\_68](https://community.glideapps.com/u/BLA_68)\
**Post date:** [June 6, 2023, 3:38am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/8 "2023-06-06T03:38:47Z")

</div>

Oh I see. Ok. Now that I get it, I like that approach. Thanks @Darren_Murphy and @Structure_Art_DIGITA.

---

<div class="post-metadata">

**Author:** ![MatthewS](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/matthews/32/40533_2.png) [@MatthewS](https://community.glideapps.com/u/MatthewS)\
**Post date:** [June 6, 2023, 3:40am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/9 "2023-06-06T03:40:00Z")

</div>

I agree with the others here… get the current date and subtract the day of week to get a consistent value for the first day of the current week.

---

<div class="post-metadata">

**Author:** ![Structure\_Art\_DIGITA](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/structure_art_digita/32/59811_2.png) [@Structure\_Art\_DIGITA](https://community.glideapps.com/u/Structure_Art_DIGITA)\
**Post date:** [June 6, 2023, 3:47am UTC](https://community.glideapps.com/t/week-number-math-issue/62466/10 "2023-06-06T03:47:05Z")

</div>

That will push him back to the previous week 😉  
You must adjust it by 1… if your week starts on Monday.

(now-weekday(now-1))+1

Then add adjustment for the week you need x 7

---

<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:** [July 1, 2023, 8:57pm UTC](https://community.glideapps.com/t/week-number-math-issue/62466/11 "2023-07-01T20:57:19Z")

</div>

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