Hi I’m trying to create a Bar Gauge dashboard for my Energy consumption in Grafana
The data is composed of two values that needed to be summed to each other. This is done by the transformation.
The idea is to create a last seven days consumption by day. So there will be 7 bars one for each day. Looking a the data as a table I can see it has the total consumption since I start measuring it and adding to Influxdb 2. So, I need the difference between each day to get the daily usage.
This is the query I’m using
|> range(start: -8d, stop: now())
|> filter(fn: (r) => r["_measurement"] == “quadro_geral”)
|> filter(fn: (r) => r["_field"] == “0_total” or r["_field"] == “1_total”)
|> aggregateWindow(every: 1d, fn: last, createEmpty: false)
|> difference( columns: [“Totalgeral}”], keepFirst: true)
It does not show the difference between each value. It shows the same total per day that I see without the difference function.
What am I doing wrong ?