I’m looking for some help to enhance the next flux query:
from(bucket: "electricityp1") |> range(start: 2022-07-15T00:00:00Z, stop: v.timeRangeStop) |> filter(fn: (r) => r["_measurement"] == "elec_p1") |> filter(fn: (r) => r["_field"] == "delivered_tarrif1" or r["_field"] == "delivered_tarrif2" or r["_field"] == "received_tarrif1" or r["_field"] == "received_tarrif2") |> first()
It’s currently extracting the record I need but every year I need to update range(start: 2022-07-15T00:00:00Z
What I want to achieve, I’m invoiced every year on the 15th of July and I have a single stat in my dashboard that shows me the index from the day of the last invoice.
If today is the 25th of September 2022 then I want to extract the record from the last 15th of July, which will in this case be the 15th of July 2022.
Of course if today is the 05th of May 2023 then I still want to extract that same last 15th of July from 2022.
I’m pretty sure they must be a more efficient way to extract that first row automatically.
Thanks for your help.