# Use Date value from one table to compare to dates in another table

**URL:** <https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426>\
**Category:** Ask for Help\
**Created:** [May 5, 2021, 7:11am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426 "2021-05-05T07:11:19Z")\
**Posts on this page:** 12\
**Page:** 1

<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:** [May 5, 2021, 7:11am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/1 "2021-05-05T07:11:19Z")

</div>

Stuck with this one…

Imagine I have two tables:

Table A:

- Has just a single row, with multiple columns
- One of those columns is a date (_update: it’s actually an if-then-else column, operating on date columns. An important point I initially overlooked…_)

Table B:

- Has multiple rows, and multiple columns
- One of those columns is a date

What I want to do is use the Table A date column in Table B, in an if-then-else column to compare it to the dates in Table B. Problem is, when I bring it in as either a Single Value or Lookup via a (single) relation, Glide no longer thinks it’s a date, so I can’t do date-type comparisons (after, before, etc).

 ![Screen Shot 2021-05-05 at 3.01.22 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/d/9db501116fe0afbaa5733ac770a9c3b7ae966d01.jpeg)

Anyone have an idea how I can work around that?

… actually it just occurred to me that I can probably convert all the dates in both tables to integers, and then do a direct numerical comparison - but that feels really clunky 🥴

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [May 5, 2021, 7:23am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/2 "2021-05-05T07:23:39Z")

</div>

Hello  
Add a math column to convert a lookup column to a date

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/3/138bb621875565b026d03d3639a1630038be1b31.png)

---

<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:** [May 5, 2021, 7:29am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/3 "2021-05-05T07:29:45Z")

</div>

Thanks!  
Off to get my COVID jab now 💉, but will give that a try later

---

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [May 5, 2021, 7:40am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/4 "2021-05-05T07:40:08Z")

</div>

That’s the one I reckon

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [May 5, 2021, 8:27am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/5 "2021-05-05T08:27:41Z")

</div>

Ah, my solution, it doesn’t work  
I did some tests and if the source of your lookup is an if column (for example) it doesn’t work.  
For the moment, well no solution.

EDIT :  
uh checkmate  
I looked for several solutions but nothing.  
Obviously the “before, after, …” conditions only work with Date or Date source fields.  
Maybe after your 💉 , you will have a brilliant idea.

---

<div class="post-metadata">

**Author:** ![SantiagoPerez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santiagoperez/32/16807_2.png) [@SantiagoPerez](https://community.glideapps.com/u/SantiagoPerez)\
**Post date:** [May 5, 2021, 9:23am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/6 "2021-05-05T09:23:15Z")

</div>

Are you using the SV \> latest?

---

<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:** [May 5, 2021, 9:40am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/7 "2021-05-05T09:40:14Z")

</div>

SV-\>First.  
Latest, etc aren’t options. I think the problem is (as @Manu.n pointed out), that the source column is an if-then-else (operating on date columns). Even though it gives a date as a result, it seems that Glide no longer treats it as a date when I pull it into my second table.

I’m going to have to fiddle with this, and think about it a bit more.

Completely open to any bright ideas 🙂

---

<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:** [May 5, 2021, 10:30am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/8 "2021-05-05T10:30:47Z")

</div>

I found a solution, which was essentially this:

> [@Darren\_Murphy](#):
>
> … actually it just occurred to me that I can probably convert all the dates in both tables to integers, and then do a direct numerical comparison - but that feels really clunky 🥴

It’s actually not that ugly. It will work.

---

<div class="post-metadata">

**Author:** ![HeartwoodTreeCo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/heartwoodtreeco/32/8150_2.png) [@HeartwoodTreeCo](https://community.glideapps.com/u/HeartwoodTreeCo)\
**Post date:** [August 13, 2025, 5:55pm UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/9 "2025-08-13T17:55:15Z")

</div>

I’m stuck on this same issue - dates that are looked up not being considered as dates in an if-then column for comparison by before or after. Another layer in my case is that the looked-up dates are then rolled up to find the earliest or latest. Since this thread is several years old, I thought I’d check if you have any new insights here. Or if your method hasn’t changed, what’s the “not that ugly” way to convert dates to integers to compare?

---

<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:** [August 13, 2025, 11:24pm UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/10 "2025-08-13T23:24:02Z")

</div>

> [@HeartwoodTreeCo](#):
>
> Or if your method hasn’t changed, what’s the “not that ugly” way to convert dates to integers to compare?

For dates only:

```auto
YEAR(D)*10^4+MONTH(D)*10^2+DAY(D)

```

For datetime (without seconds):

```auto
YEAR(D)*10^8+MONTH(D)*10^6+DAY(D)*10^4+HOUR(D)*10^2+MINUTE(D)

```

With D being the datetime object in question.

---

<div class="post-metadata">

**Author:** ![HeartwoodTreeCo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/heartwoodtreeco/32/8150_2.png) [@HeartwoodTreeCo](https://community.glideapps.com/u/HeartwoodTreeCo)\
**Post date:** [August 13, 2025, 11:37pm UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/11 "2025-08-13T23:37:26Z")

</div>

Thanks! I’ll take it from your reply that converting to numbers is still the best way to work around dates not being treated as dates in if-then columns.

---

<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:** [August 14, 2025, 1:52am UTC](https://community.glideapps.com/t/use-date-value-from-one-table-to-compare-to-dates-in-another-table/26426/12 "2025-08-14T01:52:27Z")

</div>

Yes, I think so, at least for now.
