Do not consider values that are too far from the average of the previous ones

Hi everyone, I would like to create home assistant charts. Occasionally (for unknown reasons) there is some reading error from a modbus sensor. I would like not to consider values that are too different from the previous ones. Eg. If a value is more than 20% different from the average of the last 5 it should not be considered. I would like to eliminate the spikes that are seen in the attached graph. There’s a way?

To remove spikes you can use Graphite functions for data filtering like removeAboveValue/Percentile and removeBelowValue/Percentile (Functions — Graphite 1.2.0 documentation). It won’t do exactly what you’re looking for but may help to filter out unwanted values.

Hi, thank you!
where i can find the graphite functions? consider that i’m using grafana on influxdb on Home assistant (HASSIO) installation

Best regards and thanks so much

Oh I thought you were using Graphite (the post is in Graphite category). If you’re using InfluxDB I think you can simply pass AND "field" < threshold to the WHERE clause to filter out spikes:

without filtering

with filtering:

(Only display values over a certain threshold - #4 by katy - Dashboards - InfluxData Community Forums)