# Energy per Day / Date Problem Influx v2

**URL:** <https://community.grafana.com/t/energy-per-day-date-problem-influx-v2/67574>\
**Category:** InfluxDB\
**Created:** [June 22, 2022, 1:32pm UTC](https://community.grafana.com/t/energy-per-day-date-problem-influx-v2/67574 "2022-06-22T13:32:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelrhens](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@michaelrhens](https://community.grafana.com/u/michaelrhens)\
**Post date:** [June 22, 2022, 1:32pm UTC](https://community.grafana.com/t/energy-per-day-date-problem-influx-v2/67574/1 "2022-06-22T13:32:16Z")

</div>

Hello,

I use an energy meter SDM630 that writes the data to the Flux database via MBMD.  
([GitHub - volkszaehler/mbmd: ModBus Measurement Daemon - simple reading of data from ModBus meters and grid inverters](https://github.com/volkszaehler/mbmd))  
It writes every some seconds the current power.  
This works as far as it goes.

I would like to display the energy consumption per day in Grafana. My problem is that the last date is double and the first date has wrong values (should be around 12kW per day).  
(See screenshot markings)

 ![Bildschirmfoto 2022-06-22 um 15.05.15](https://us1.discourse-cdn.com/grafana/original/3X/b/b/bb19c2ddd5f428f151873d2d6aee7f2d3aafb90b.png)

This is my current query:  
Do you have any idea how the query should be correct?

```auto

from(bucket: "sdm630")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "data")
  |> filter(fn: (r) => r["_field"] == "value")
  |> filter(fn: (r) => r["device"] == "SDM1.1")
  |> filter(fn: (r) => r["type"] == "Power")
  |> aggregateWindow(every: 24h, 
                    fn: (column, tables=<-) => tables |> integral(unit:1h, interpolate: "linear"),
                    createEmpty: false)

```

Thank you Gudio

---

<div class="post-metadata">

**Author:** ![anon70503803](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@anon70503803](https://community.grafana.com/u/anon70503803)\
**Post date:** [June 30, 2022, 10:15pm UTC](https://community.grafana.com/t/energy-per-day-date-problem-influx-v2/67574/2 "2022-06-30T22:15:58Z")

</div>

welcome to the :grafana: forum, @michaelrhens

have you searched this forum for similar topics? This comes up a lot (influx data, arranged in a per-day view)
