How does the kaufmans adaptive moving average actually work?


#1

Maybe I am totally wrong, but I basically wanted to create a moving average that shows the average of the past 24hs at any time.
SELECT KAUFMANS_ADAPTIVE_MOVING_AVERAGE(MEAN("value"), 2) FROM "°C" WHERE ("entity_id" = 'temperature_158d000119f402') GROUP BY time(1d)

Is it even possible to create a time interval based moving average, at all?


#2

I wonder if you can’t use use MOVING_AVERAGE (docs here) to get what you’re looking for.

In the advanced section of the docs, it walks through using GROUP_BY to apply a moving average to a nested function.

I’m not sure if this does exactly what you need, but hopefully it’s a good start.


#3

SELECT moving_average(mean("value"), 24) FROM "°C" WHERE ("entity_id" = 'temperature_158d000119f402') AND $timeFilter GROUP BY time(1h)

That is working fine for a normal average :slight_smile: