@samdanisms If you don’t need to store the values, the Flux will work. Grafana supports Flux: Flux (InfluxDB) [BETA] plugin for Grafana | Grafana Labs
But you also need to enable it in InfluxDB 1.7.8: Get started with Flux | Flux 0.x Documentation
I don’t know the exact structure of your data, but the Flux query would look something like this:
collectionInterval = 5.0
from(bucket: "database/retention-policy")
|> range(start: -7d)
|> filter(fn: (r) =>
r._measurement == "measurement-name" and
(r._field == "voltage" or r._field == "current")
)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> map(fn: (r) => ({
r with
power: r.current * r.voltage,
energy: r.current * r.voltage * collectionInterval
}))
|> aggregateWindow(every: 1d, column: "energy", fn: sum)