# How to use last\_over\_time?

**URL:** <https://community.grafana.com/t/how-to-use-last-over-time/150007>\
**Category:** Prometheus\
**Created:** [May 9, 2025, 12:03am UTC](https://community.grafana.com/t/how-to-use-last-over-time/150007 "2025-05-09T00:03:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dawiddebowski](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/dawiddebowski/32/49435_2.png) [@dawiddebowski](https://community.grafana.com/u/dawiddebowski)\
**Post date:** [May 9, 2025, 9:11pm UTC](https://community.grafana.com/t/how-to-use-last-over-time/150007/4 "2025-05-09T21:11:22Z")

</div>

Hi,  
AFAIK the `last_over_time` function will shift the last point before no data (as long as the last point is in the range). It will return time series where each point will represent the last visible point (I’ll share some prepared screenshots, sorry for lack of queries but I’m using some custom metric and data privacy 🤷‍♂️)  
Regular data returned by expression `metric`:

 ![Zrzut ekranu 2025-05-9 o 23.08.00](https://us1.discourse-cdn.com/grafana/original/3X/4/b/4be062aab1f7783513038b81e92256fd0b4e391d.png)

The data returned with expression `last_over_time(metric[$__range])` (notice I’m using `$__range` and not `$__interval`):

 ![Zrzut ekranu 2025-05-9 o 23.08.59](https://us1.discourse-cdn.com/grafana/original/3X/1/4/140a5fb1ae2eadee2289490b7900a2242531e921.png)

The last point was shifted to “now”.

What I think you need is to use `last_over_time` with `$__range` (or e.g. `1h`) lookbehind window (not `$__interval` since it might be too small range for your case) and use instant query. Notice that if the metric wasn’t updated (returns no data) for more than the range in lookbehind window, it will still return no data - you can’t just ask for the last point and expect it to forever be (your metric could have changed for example and it’s not even there).

---

_[View the full topic](https://community.grafana.com/t/how-to-use-last-over-time/150007)._
