Hi all!

I’m a newbie of influxdb, and start to test influxDB with Grafana (latest version of both).

I’ve a data series of instant DC power (Watt) that flow in a rechargeable battery.

The power has positive value when battery discharge and negative value when battery charge.

I want to calculate the energy (Watt hour) for charge and discharge phase.

For do this, I’ve used the integral function using clause WHERE, and create these 2 queries in Grafana:

_cumulative_sum(integral(“value”)) / 3600 FROM “Battery_Power” WHERE (“value” > 1 ) AND $timeFilter GROUP BY time($_*interval)*

_SELECT cumulative_sum(integral(“value”)) / 3600 FROM " Battery_Power " WHERE (“value” < 1) AND $timeFilter GROUP BY time($_*interval)*

Often the query work fine, and show a chart as I expected, other times, on chart I not see a data of integral, but the value seem have an offset.

Someone has same issue, or I’ve completely wrong my query syntax?

Thank you!