# Calculate the average between database of dates, right approach?

**URL:** <https://community.glideapps.com/t/calculate-the-average-between-database-of-dates-right-approach/69163>\
**Category:** Ask for Help\
**Created:** [January 1, 2024, 7:57pm UTC](https://community.glideapps.com/t/calculate-the-average-between-database-of-dates-right-approach/69163 "2024-01-01T19:57:49Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 2, 2024, 4:53pm UTC](https://community.glideapps.com/t/calculate-the-average-between-database-of-dates-right-approach/69163/6 "2024-01-02T16:53:09Z")

</div>

Here’s a slightly easier spin on my second suggestion above.

> [@Creating a formula to maintain a running balance](https://community.glideapps.com/t/creating-a-formula-to-maintain-a-running-balance/68973/2):
>
> The query column can help you with this. The video below walks through setting it up.

The concept would be similar as far as creating row indexes. As for the query, I would change the compare to look for indexes ‘less than’ the current row index instead of ‘less than or equal’. I would add a second condition to only match the user to their own rows (maybe comparing emails). I would then change the sorting by date in reverse order and set it to return only 1 row. With that query set up, then you can create a single value column that retrieves the date value from through the query. You should send up with a date from the previous entry for that user that you can use with a math column and rollup to get the average.

---

_[View the full topic](https://community.glideapps.com/t/calculate-the-average-between-database-of-dates-right-approach/69163)._
