Aggregation issues

Grafana has “magic” variable $__interval, which calculates aggregation period based on current dashboard time range automatically.

But you can define time groupping period explicitly. So if you need 1d, then:

SELECT sum("field") 
FROM measurement
WHERE $timeFilter 
GROUP BY time(1d)

You can also create own dashboard variable (Type: Interval) and define own aggregation periods there + custom auto value as well and then you can use it in GROUP BY time($mycustomaggregationvariable).

2 Likes