SUM is not working properly

I know this is a basic question, but I have been watching video tutorials and read online, but new to Grafana and things are not working out for me, I decided to ask here for help.

I have Grafana integration with InfluxDB and HomeAssistant, I am trying to pull data and get daily power usage in this particular example.

I have smart outlets, Home Assistant is recording the consumption value once every 1 min.

When I do SUM I do expect all values to be SUMed into one number, but it’s not the case. I am asking for help to tell me what do I do wrong…

Thanks in advance.

Hi @departy ,

Have you tried adding a transformation to your query?

@departy just another guess in addition to what @mattabrams said - if you’re literally looking for the sum total of all readings within your time range, then you need to remove the GROUP BY time($interval) element.

Having a GROUP BY time($_interval) is what you want when plotting a graph, since then your time range will be subdivided into multiple short intervals, and your query will get the sum of power readings in each interval. But if you need a single total value (and not a graph) then you need to remove that interval grouping. And probably switch to a stat panel, or something similar that’s suited for displaying a single value.

1 Like