Hi friends,
I’m using Grafana 10.11 and it is getting the data from InfluxBD 2.0 version (flux)
I’m gathering energy consumption data and the aggregating it to days, weeks and months.
But data shown in different formats shows the last aggregation time (day, week or month) typically twice as long as the aggregation for the last period is ongoing.
Like here day (18.9)
Three separate queries
from(bucket: "IELEC2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT4")
|> filter(fn: (r) => r["_field"] == "Usage_kW")
|> aggregateWindow(every: 24h, fn: sum, createEmpty: false)
from(bucket: "IELEC2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT4")
|> filter(fn: (r) => r["_field"] == "Price")
|> aggregateWindow(every: 24h, fn: sum, createEmpty: false)
from(bucket: "IELEC2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Nordpool_price")
|> filter(fn: (r) => r["_field"] == "Nordpool_Price_kW")
|> aggregateWindow(every: 24h, fn: sum, createEmpty: false)
and here on Months (09-23)
bucket1 = from(bucket: "IELEC2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT4")
|> filter(fn: (r) => r["_field"] == "Usage_kW")
|> aggregateWindow(every: 1mo, fn: sum, createEmpty: false)
bucket2 = from(bucket: "IELEC_CT_CLAMPS_HIST")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT_CLAMPS")
|> filter(fn: (r) => r["Name"] == "CT4")
|> filter(fn: (r) => r["_field"] == "CT4_Usage_kW")
|> aggregateWindow(every: 1mo, fn: sum, createEmpty: false)
union(tables: [bucket1, bucket2])
bucket1 = from(bucket: "IELEC2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT4")
|> filter(fn: (r) => r["_field"] == "Price")
|> aggregateWindow(every: 1mo, fn: sum, createEmpty: false)
bucket2 = from(bucket: "IELEC_CT_CLAMPS_HIST_PRICE")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT_CLAMPS_1")
|> filter(fn: (r) => r["Name"] == "CT4")
|> filter(fn: (r) => r["_field"] == "Price")
|> aggregateWindow(every: 1mo, fn: sum, createEmpty: false)
union(tables: [bucket1, bucket2])
bucket1 = from(bucket: "IELEC2")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Nordpool_price")
|> filter(fn: (r) => r["_field"] == "Nordpool_Price_kW")
|> aggregateWindow(every: 1mo, fn: sum, createEmpty: false)
bucket2 = from(bucket: "IELEC_CT_CLAMPS_HIST")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CT_CLAMPS")
|> filter(fn: (r) => r["Name"] == "CT4")
|> filter(fn: (r) => r["_field"] == "Nordpool_Price_kW")
|> aggregateWindow(every: 1mo, fn: sum, createEmpty: false)
union(tables: [bucket1, bucket2])
I use transformations on the last panel (as it reads two data set from old historical data and combines it with new (slightly different naming rules). No transforms on the 1st panel on daily aggregates.
The numbers get “correct” once I move to next aggregation interval ,like day/week or month, but during that period I see them twice. Haven’t really figured how the data is divided or how I could only see the only one value; aggregated data up to that point from start of the aggregation period.
Any help or pointers where to find answers is appreciated. Thank you !