Return max value of time series with corresponding timestamp

Hey,

I can’t manage to return the max. value of a time series data in my influxdb together with the corresponding timestamp of die max. value?!

The query just returns the latest timestamp of the time series, rather than the timestamp of the day where the max value occured!

I used the following query:

SELECT max(“value”) FROM “E_today” WHERE time > ‘2023-01-01 00:00:00’ and time <‘2023-12-31 00:00:00’ GROUP BY time(1d) fill(null)

But the result is:
image

As you can see, the timestamp is the last the of the specified time frame of the query (the max value is of course correct)

Does anyone have an idea where the problem is?

I am not well versed on InfluxQL, but does this give a correct result?

SELECT max(“value”) FROM “E_today” WHERE time > ‘2023-01-01 00:00:00’ and time <‘2023-12-31 00:00:00’

oh man…it really gives the correct result!! Thank you!

but as it turns out, omitting the “GROUP BY” statement returns the correct max value incl. corresponding time stamp for a single query, but it does not work with an expression!?

using the query as in my first post results in this (correct max. value but incorrect timestamp):

whereas using the query suggested by grant2 results in nothing at all:

any ideas, how to get the max value incl. timestamp of an expression?

@luefterfreak

Just playing around with the data at play.grafana.org, this is the 6-hour graph that is presented. You can see the max is about 377 at 16:22:

A minute or two later (basically when the max value had falled one point), I did the previously mentioned query, changed the view to Stat and selected All fields. Doing that shows the timestamp for the max value as well as the max value. Is that what you want?

Well, that was one point which is solved by your suggested query. Thanks!

But the second point is to create an expression which adds two time series data. And for the resulting “sum data” I am also interested in the max. value incl. the timestamp.

But as shown by my screenshots above, for the expression (summing up $Dach_PV + $BKW_PV) I get no value displayed.
So my question now is, how can I retrieve the max. value incl. the timestamp of an expression, which sums up several time series data (queried with your suggested query)?