Show last value in influx - independant of time

Hello there,
What I want to do is to display the last value of the measurement. No matter if the last measurement was last week, last month, last year or maybe even 10 years before. The problem is that Grafana wants me to set a time range, either in the calendar or in query options, while I want it to be showing the last value, regarding it’s lifetime.
I’d be very grateful if i could get a fast reply from anyone, since I am currently working on it.
Thank you all in advance.

1 Like

Use the query editor to remove the “and $timeFilter” from your query and use
the “last” function if your datasource supports it, or something like “order
by timestamp desc limit 1” if it doesn’t.

Antony.

1 Like

Hello Antony,
first of all thank you very much for your fast reply.
The “last” function that you mentioned does work in influx. I tried it already but it would always show me more than one value. I also removed the “AND $timeFilter” as you mentioned. I have tried formatting as table and as logs instead, but it would still show me more than one value with the last() function. Maybe I shouldn’t have formatted as table or logs instead of a timeseries for it to work, but I wonder what else I could use to make it work. Table and logs is all it offers to me besides timeseries and the both are showing several values with the last() function :frowning:
Greetings, Florian

I could fix it. I wrote a query not including the “AND $timeFilter” but when i clicked on the pen to see the offered options again, it decided to reset my self written query and put the “AND $timeFilter” back into my query. Thats why it didn’t work. I did it correct from the beginning but I always accidentaly overwrote my own query by clicking the pen after ^^ I think Grafana should change that. Clicking the pen should only change the display of the query but not it’s content.

1 Like

I completely agree and I regard this as a bug in Grafana, not merely a highly
undesirable feature.

Antony.

1 Like