Extract Daily Values

I’m new to grafana, i’m using it with influxdb and I’m collecting values from OpenHab.
Database in very simple, 2 columns:


What I need is to calculate Power usage for current day from 00:00 to 23:59, in a SingleStat panel.
I need to calculate total Kw/h used since 00:00 of current day.

I Also need a bar graph showing total power usage for last days (configurable if possible).
In same dashboard I need to have also Realtime power usage for last 12 hours.
Something like that:

How can I perform this?
Grafana Docker Latest
InfluxDB 1.2.2

Many thanks in Advance

Are you having problems writing the query or combining the different time ranges on one dashboard?

  • For power usage for current day, you would choose the Today option from the time picker in the top right corner. The query would look something like this:

    SELECT sum("value") FROM "your_table" WHERE $timeFilter GROUP BY time($interval)

  • The queries for the other panes would be similar but you need to use the override relative time option to combine different time ranges on the same dashboard.


1 Like

Hi Community

I think I have a similar problem.
i use grafana with influxdb and I’m collecting values from OpenHab.
Database in very simple, 2 columns:


Openhab save valuee for power consumption in €.
I get the representation of daily consumption in grafana not shown exactly.

Example Date: 06.06.2017

I have export the database from influx and have counted the values from 06.06.2017.
The result was 0,125€.

In grafana i have group by time (1d) and select difference and test some aggregations (distinct, mean, median and mode)
but nothing show me the right value.
I’m not sure what I have to adjust.
And why is the time off a bar from a single day every 02:00:00?

I need some help please

@ MArcolino,I think that Continuos Queries is what you’re looking for

Hello everyone,

@marcolino7, I was wondering if you finally did solve your problem? Is Continuous Queries really the only way to go for what you wanted to do?

I have the feeling we are so close to get Grafana to display what we want, almost straight without any influxdb additional config, that I am still hoping we don’t need Continous Queries…