Moving Average in Perspective Chart?

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)?

I did it using a Query Tag

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