# How to filter the maximum value of the last 24 hours

**URL:** <https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566>\
**Category:** General\
**Created:** [5 July 2020 18:03 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566 "2020-07-05T18:03:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [5 July 2020 18:03 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/1 "2020-07-05T18:03:20Z")

</div>

Hi,

i'd like to show the maximum value of the last 24 hours on the dashboard with the ui-level node.  
The RBE node ist nearly perfect but it only let me filter the greater like XXX or equal to the last value. But i want to get only the bigger value then the last one.

In my case i want to show the max measurement of the LUX value of the last 24h on the Dashboard.

thx in advance

Felix

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [5 July 2020 18:40 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/2 "2020-07-05T18:40:57Z")

</div>

should be possible in a change node with a JSONata expression. Have a look at this thread

> [@JSONata: Get max and minimum temperature with timestamp](https://discourse.nodered.org/t/jsonata-get-max-and-minimum-temperature-with-timestamp/26879):
>
> Ok, we have this data from influx. Temperature over the last 30 minutes [{"time":"2020-05-18T19:09:53.000Z","Temperatur":24.1},{"time":"2020-05-18T19:09:58.000Z","Temperatur":24},{"time":"2020-05-18T19:12:48.000Z","Temperatur":23.9},{"time":"2020-05-18T19:13:27.000Z","Temperatur":24},{"time":"2020-05-18T19:13:33.000Z","Temperatur":23.9},{"time":"2020-05-18T19:13:48.000Z","Temperatur":24},{"time":"2020-05-18T19:13:55.000Z","Temperatur":23.9},{"time":"2020-05-18T19:16:33.000Z","Temperatur":23.8},…

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [6 July 2020 00:54 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/3 "2020-07-06T00:54:27Z")

</div>

Can't you just store the last value - compare the next value coming in - if it is greater - store that - if not throw it away - you will always have the highest value kept in the variable which can just be displayed on the dashboard.

Craig

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [6 July 2020 02:20 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/4 "2020-07-06T02:20:27Z")

</div>

There is a solution for a similar problem in the following post:

[I need to do a very simple task: record maximum and minimum values.  
I want some node to compare the current value with the previous one and see if it is bigger or smaller. If so, return and update the maximum and minimum values. Otherwise, retone null.](https://discourse.nodered.org/t/knot-following/26999)

---

<div class="post-metadata">

**Author:** ![yyjdennis](https://avatars.discourse-cdn.com/v4/letter/y/b77776/32.png) [@yyjdennis](https://discourse.nodered.org/u/yyjdennis)\
**Post date:** [6 July 2020 18:38 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/5 "2020-07-06T18:38:01Z")

</div>

Use the smooth node. It has an option to return the minimum or maximum value seen over the last x values.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [7 July 2020 22:19 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/6 "2020-07-07T22:19:26Z")

</div>

I did not even think of using that - well done !!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 July 2020 22:19 UTC](https://discourse.nodered.org/t/how-to-filter-the-maximum-value-of-the-last-24-hours/29566/7 "2020-07-21T22:19:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
