# Ability for calculating moving average

**URL:** <https://www.singlestore.com/forum/t/ability-for-calculating-moving-average/3703>\
**Category:** Feedback\
**Created:** [January 5, 2022, 5:33pm UTC](https://www.singlestore.com/forum/t/ability-for-calculating-moving-average/3703 "2022-01-05T17:33:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pini\_Faran](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/p/f14d63/32.png) [@Pini\_Faran](https://www.singlestore.com/forum/u/Pini_Faran)\
**Post date:** [January 5, 2022, 5:33pm UTC](https://www.singlestore.com/forum/t/ability-for-calculating-moving-average/3703/1 "2022-01-05T17:33:48Z")

</div>

We would like to calculate moving average over time window, **not** over number of rows (as i can do today).

The ideal solution would be implementing something similar to what Vertica supports:  
[https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AnalyzingData/SQLAnalytics/CalculatingMovingAverage.htm](https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AnalyzingData/SQLAnalytics/CalculatingMovingAverage.htm)

This is something we would like to be supported in the latest versions (7.x)

---

<div class="post-metadata">

**Author:** ![hanson](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/hanson/32/196_2.png) [@hanson](https://www.singlestore.com/forum/u/hanson)\
**Post date:** [August 1, 2023, 11:58pm UTC](https://www.singlestore.com/forum/t/ability-for-calculating-moving-average/3703/2 "2023-08-01T23:58:15Z")

</div>

Got it. You may be able to do what you need with a Wasm user-defined aggregate with Handle state. Check out the docs:

> **[CREATE AGGREGATE · SingleStore Documentation](https://docs.singlestore.com/cloud/reference/sql-reference/procedural-sql-reference/create-aggregate/)**
>
> SingleStore is a modern relational database for cloud and on-premises that delivers immediate insights for modern applications and analytical systems. Book a demo or trial today!
