# Preserving max value and averaging on large time range

**URL:** <https://community.grafana.com/t/preserving-max-value-and-averaging-on-large-time-range/57491>\
**Category:** Time Series Panel\
**Created:** [December 10, 2021, 10:10am UTC](https://community.grafana.com/t/preserving-max-value-and-averaging-on-large-time-range/57491 "2021-12-10T10:10:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuoguoto](https://avatars.discourse-cdn.com/v4/letter/x/59ef9b/32.png) [@xuoguoto](https://community.grafana.com/u/xuoguoto)\
**Post date:** [December 10, 2021, 10:10am UTC](https://community.grafana.com/t/preserving-max-value-and-averaging-on-large-time-range/57491/1 "2021-12-10T10:10:25Z")

</div>

Hello all,

 ![Screenshot 2021-12-10 at 15-18-22 ERX Overview - Grafana](https://us1.discourse-cdn.com/grafana/original/3X/b/7/b78effb007723c21821c6ca95e3dc779cc554367.png)

In the above graph, the max value is 14, and here I have displayed one hour worth of data. Now if I zoom out and display 24 hours data, the graph is as follows:

 ![Screenshot 2021-12-10 at 15-16-58 ERX Overview - Grafana](https://us1.discourse-cdn.com/grafana/original/3X/4/7/4742a2e8b3a66c49deaf511a616a9cd060b8dae0.png)

Here the max value becomes 11. From what I understand this happens because the data is averaged out with a wider range of data.

But I want to preserve the max data. (This graph is tracking utilisation of a resource, and the max utilisation is the important metric here).

How can I configure the graph so that irrespective of the time range selected, the max value is selected to display from a time window, instead of current average value of all the data points?

The data source I am suing is prometheus, and the query is `sum(saturation_in_value{}) + sum(saturation_out_value{})`

X.

---

<div class="post-metadata">

**Author:** ![gildos](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@gildos](https://community.grafana.com/u/gildos)\
**Post date:** [May 17, 2022, 10:24pm UTC](https://community.grafana.com/t/preserving-max-value-and-averaging-on-large-time-range/57491/2 "2022-05-17T22:24:47Z")

</div>

Try to use the [consolidateBy](https://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.consolidateBy) function.

---

<div class="post-metadata">

**Author:** ![marcosmouranz](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@marcosmouranz](https://community.grafana.com/u/marcosmouranz)\
**Post date:** [June 9, 2022, 2:17am UTC](https://community.grafana.com/t/preserving-max-value-and-averaging-on-large-time-range/57491/3 "2022-06-09T02:17:15Z")

</div>

Hi guys, I’m facing the same problem but I’m not using Graphite. My datasource is Prometheus.  
So any recommendation on how to solve this problem, maybe a similar approach as used by consolidateBy with Graphite?
