# Query without duplicates

**URL:** <https://community.glideapps.com/t/query-without-duplicates/70569>\
**Category:** Ask for Help\
**Created:** [February 7, 2024, 5:25am UTC](https://community.glideapps.com/t/query-without-duplicates/70569 "2024-02-07T05:25:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikaeldorval](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikaeldorval/32/67405_2.png) [@Mikaeldorval](https://community.glideapps.com/u/Mikaeldorval)\
**Post date:** [February 7, 2024, 5:25am UTC](https://community.glideapps.com/t/query-without-duplicates/70569/1 "2024-02-07T05:25:45Z")

</div>

Hello Gliders, I’m having trouble setting up charts on data. It’s for a personal finance app for me and I’m syncing bank transactions via a Google Sheets extension.

I want to show account balances on multiple dates to show the progress of those accounts. Source for the chart is a query column of my different account balances.

The problem I’m facing is that every time the Google sheets extension syncs it creates a new row with the current account balance. This results in sometimes having multiple balances for the same date.

When showing a line chart the balances with the same dates sum up and I end up with false numbers on dates that have more than one sync (row).

I tried filtering my query column but couldn’t figure out how to keep only the last synced row for each date.

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [February 7, 2024, 9:30am UTC](https://community.glideapps.com/t/query-without-duplicates/70569/2 "2024-02-07T09:30:06Z")

</div>

Hi, Mikaeldorval!  
I think you can use rollup to finde Latest date then you can use it in you query to check the date of transaction is Latest date.

---

<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:** [February 7, 2024, 12:52pm UTC](https://community.glideapps.com/t/query-without-duplicates/70569/3 "2024-02-07T12:52:09Z")

</div>

Yes, this should work. To clarify, in your data table:

1. convert all dates to numbers (`year(date)*10^4+month(date)*10^2+day(date)`)
2. create a relation column (matching multiple) that relates this value back to itself
3. create a rollup column that points to this relation and grabs the maximum date value column from step 1
4. create an if-then-else column that outputs `true` when date value matches the rollup value
5. use this `true` value as a filter in your query (is checked)

---

<div class="post-metadata">

**Author:** ![Mikaeldorval](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikaeldorval/32/67405_2.png) [@Mikaeldorval](https://community.glideapps.com/u/Mikaeldorval)\
**Post date:** [February 18, 2024, 8:50pm UTC](https://community.glideapps.com/t/query-without-duplicates/70569/4 "2024-02-18T20:50:50Z")

</div>

I tried your solution but the problem is since every sync gives a date only with a time of midnight for each one there is no max number for a day. It relates back every sync for each day.

Is there another way this could be done?

---

<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:** [February 18, 2024, 10:59pm UTC](https://community.glideapps.com/t/query-without-duplicates/70569/5 "2024-02-18T22:59:09Z")

</div>

Instead of rollup, use a single value column that just returns the last record (assuming all rows are in chronological order).
