In the influx DB i have a field called ‘value’. I want to calculate the mean & stddev of sums ( of value ) from last n windows.
For example, lets say individual sum of value in last 3 hours is:
1 hour -> 20
2 hour -> 30
3 hour -> 40
So mean will be 45.
In the next window it should take the next three hours, find the individual sum and take the mean.
For example, lets say sum of value in last 3 hours is:
1 hour -> 30
2 hour -> 40
3 hour -> 60
So mean will be 75.
I was thinking i can do something like this:
|query('''SELECT sum(value) FROM "db"."autogen".measurement''') .period(3h) .every(1h) .groupBy(time(1h), 't1', 't2')` |mean('sum')
But the above tickscript is finding total sum of last n hours not n sums of 1h each.
Please let me know if there is cleaner way to get this kind of nested aggregation.