# Count and display values exceeding thresholds from air quality measurements within Grafana

**URL:** <https://community.panodata.org/t/count-and-display-values-exceeding-thresholds-from-air-quality-measurements-within-grafana/97>\
**Category:** Air quality data\
**Tags:** grafana, influxdb\
**Created:** [December 1, 2019, 10:47pm UTC](https://community.panodata.org/t/count-and-display-values-exceeding-thresholds-from-air-quality-measurements-within-grafana/97 "2019-12-01T22:47:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![centralinedalbasso](https://community.panodata.org/user_avatar/community.panodata.org/centralinedalbasso/32/29_2.png) [@centralinedalbasso](https://community.panodata.org/u/centralinedalbasso)\
**Post date:** [December 1, 2019, 10:47pm UTC](https://community.panodata.org/t/count-and-display-values-exceeding-thresholds-from-air-quality-measurements-within-grafana/97/1 "2019-12-01T22:47:14Z")

</div>

Dear @wtf,

coming from [Hello from a group of Italian citizens interested in environment and environmental measurements](https://community.panodata.org/t/hello-from-a-group-of-italian-citizens-interested-in-environment-and-environmental-measurements/29) and [Access to InfluxDB or Grafana instance with data from luftdaten.info for Italy](https://community.panodata.org/t/access-to-influxdb-or-grafana-instance-with-data-from-luftdaten-info-for-italy/39), we would like to know if you see a simple way or plugin for Grafana to count the “over the threshold” values within a given time-range?

Thanks already!

---

<div class="post-metadata">

**Author:** ![wtf](https://community.panodata.org/user_avatar/community.panodata.org/wtf/32/25_2.png) [@wtf](https://community.panodata.org/u/wtf)\
**Post date:** [December 4, 2019, 8:42am UTC](https://community.panodata.org/t/count-and-display-values-exceeding-thresholds-from-air-quality-measurements-within-grafana/97/2 "2019-12-04T08:42:51Z")

</div>

> [@centralinedalbasso](#):
>
> we would like to know if you see a simple way or plugin for Grafana to count the “over the threshold” values within a given time-range?

Friends of precise wording will say at this point that you must be talking about your database and not about Grafana. 😉 So assuming we still talking about InfluxDB: You would like to filter for field-values above a certain threshold, e.g. with `P2 > 50` in the beginng of the query and generate daily mean within the timefilter, e.g. with `time(1d)`. But to my understanding, this would most-likely end up with wrong results cause I think the filter is applied on the raw data first and not the aggregated daily values.

So the better approach would be to build a little more complex flux-query for this. There you can apply filter and aggregations in the order you like. I haven’t done such a query yet, but I feel that I will probably do so very soon and post about this here again.
