# Select maximum value over the past 24 hrs

**URL:** <https://community.grafana.com/t/select-maximum-value-over-the-past-24-hrs/44111>\
**Category:** Grafana\
**Created:** [March 7, 2021, 10:23am UTC](https://community.grafana.com/t/select-maximum-value-over-the-past-24-hrs/44111 "2021-03-07T10:23:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grans](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@grans](https://community.grafana.com/u/grans)\
**Post date:** [March 7, 2021, 10:23am UTC](https://community.grafana.com/t/select-maximum-value-over-the-past-24-hrs/44111/1 "2021-03-07T10:23:25Z")

</div>

As a Grafana newbie I want to display the maximum temperature of the measured past 24 hours in a gauge. For that I use this query:

```
SELECT MAX("tempachtertuin") FROM "lucht" WHERE $timeFilter GROUP BY time(24h) fill(null)

```

Unfortunately that is not going well, the query shows the current temperature and not the maximum over 24 hours. I am too inexperienced, can someone tell me which query to use?

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [March 7, 2021, 2:33pm UTC](https://community.grafana.com/t/select-maximum-value-over-the-past-24-hrs/44111/2 "2021-03-07T14:33:19Z")

</div>

What about the option in the right side (“Calculation”) set to Max? In my example shown below, 203 F is the maximum temperature over the last 30 minutes. If I changed the time dropdown to 3 hours, it would show the maximum temperature over the last 3 hours.

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/1/15412de2fe1fd7a1a1ec13035a84eefc1840d9c0.png)

---

<div class="post-metadata">

**Author:** ![grans](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@grans](https://community.grafana.com/u/grans)\
**Post date:** [March 7, 2021, 4:02pm UTC](https://community.grafana.com/t/select-maximum-value-over-the-past-24-hrs/44111/3 "2021-03-07T16:02:23Z")

</div>

Great, thanks for helping. Appreciated!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [March 7, 2022, 10:24am UTC](https://community.grafana.com/t/select-maximum-value-over-the-past-24-hrs/44111/4 "2022-03-07T10:24:09Z")

</div>

Closed on March 7, 2022, 10:24am UTC

This topic was automatically closed after 365 days. New replies are no longer allowed.
