# Moving Average in Perspective Chart?

**URL:** <https://forum.inductiveautomation.com/t/moving-average-in-perspective-chart/41469>\
**Category:** Maker\
**Created:** [December 13, 2020, 1:08am UTC](https://forum.inductiveautomation.com/t/moving-average-in-perspective-chart/41469 "2020-12-13T01:08:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sungkhum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sungkhum/32/10636_2.png) [@sungkhum](https://forum.inductiveautomation.com/u/sungkhum)\
**Post date:** [December 13, 2020, 1:08am UTC](https://forum.inductiveautomation.com/t/moving-average-in-perspective-chart/41469/1 "2020-12-13T01:08:39Z")

</div>

What’s the best way to create a moving average from a tag with history enabled in a Perspective Time Series Chart (trying to smooth out the chart line)?

---

<div class="post-metadata">

**Author:** ![sungkhum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sungkhum/32/10636_2.png) [@sungkhum](https://forum.inductiveautomation.com/u/sungkhum)\
**Post date:** [December 13, 2020, 6:21am UTC](https://forum.inductiveautomation.com/t/moving-average-in-perspective-chart/41469/2 "2020-12-13T06:21:29Z")

</div>

I did it using a Query Tag

```auto
SELECT AVG(intvalue) FROM
(
    SELECT intvalue FROM sqlt_data_1_2020_12 WHERE tagid=11 ORDER BY t_stamp DESC LIMIT 20
)

```
