I’ve currently written an InfluxDB query that:
- Sets a time range of 1 hour before the current time.
- Applies filters for a single ‘measurement’, ‘_field’, and multiple ‘tags’.
- Aggregates data into 15-minute intervals and calculates the ‘max’ value within each interval.
Here’s an example of the query:
from(bucket: "bk")
|> range(start: -1h)
|> filter(fn: (r) => r["_measurement"] == "ED")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["tag"] =~ /TAG1_Hz|TAG1_Ia|TAG1_Ib/)
|> aggregateWindow(every: 15m, fn: max, createEmpty: false)
|> limit(n:4)
|> yield(name: "max")
However, I need to additionally extract the date when the ‘max’ value occurred. Unfortunately, I’m not very familiar with InfluxDB and am having trouble with this. Could you please help me?
The data I want to obtain (highlighted in red):