I am looking for a way to compare the “gas consumption” of the current year with that of last year.
Can this be realized in Grafana?
I use Grafana and InfluxDB (Flux).
Attached is a picture of how I would like to do it.
Time series 1 = today - 1 year (2023 Today -12 months)
Time series 2 = “today”-1 year - “-1 year” (2022 - 12 months).
I think the picture clarifies quite well what I mean.
ich habe einen Tag zuvor eine ähnliche Anfrage gestellt, aber noch keine Antwort erhalten.
Can you share the current Flux query that you have created (just to return the gas consumption over time) and a small subset of the data output? I am pretty sure what you are asking is possible using Flux.
Hi @grant2 ,sorry for the delay:
import "timezone" option location = timezone.location(name: "Europe/Berlin") from(bucket: "iobroker") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "Gaszaehlerstand") |> filter(fn: (r) => r["_field"] == "value") |> difference() |> aggregateWindow(every: 1mo, fn: sum, timeSrc: "_start")
OK, this is not a perfect solution, but will hopefully get you started…
In the graph below, I am plotting daily energy usage from 01-Dec to 31-Jan:
Adding these two statements will give you the month-over-month view. More here.
|> window(every: 1mo) |> experimental.alignTime(alignTo: 2021-12-01T00:00:00Z)
You will notice that the start of the graph begins with 30-Nov and for some reason does not have two series displayed for the 30th & 31st. Maybe @ldrascic or @yosiasz can tell me / us why.
Hi @grant2 , thanks it looks good.
But how did you change the colors?
I can not change the separate.
Hi @grant2 can you plz help me again.
with the standart options i can not change the colors separate.
Edit: Solution = Color scheme > "Classic palette