Filter values below a threshold in influx

Hello,

it seems a very simple request, but I am failing after more than one hour of searching forums and stackoverflow:
I have some outliers in my data. For that, I want to display only values below a certain threshold.
The query currently is

SELECT spread(“value”) FROM “Haustechnik.Stromzaehler.Zaehlerstand” WHERE $timeFilter GROUP BY time(1d) fill(null)

I have tried

SELECT spread(“value”) FROM “Haustechnik.Stromzaehler.Zaehlerstand” WHERE (“value” < 50) AND $timeFilter GROUP BY time(1d) fill(null)

But I understand that this filters out values < 50, whereas I want to filter out if the result of "spread(“value”) is smaller than 50.

I have also tried “INTO” but it seems that I do not understand the syntax.

Can you help me on this, please?

Regards,
Hendrik

Where spread(“value”)  < 50

Thanks for your reply.

I tried this:

SELECT spread(“value”) FROM “Haustechnik.Stromzaehler.Zaehlerstand” WHERE ($timeFilter AND spread(“value”) < 50) GROUP BY time(1d) fill(null)

But it lead to this error:

message:“InfluxDB Error: error parsing query: found “, expected identifier, string, number, bool at line 1, char 128”

Did I mis-understand?

Best regards,
Hendrik

Can someone help me on this, please?

SELECT spread("value") FROM "Haustechnik.Stromzaehler.Zaehlerstand" WHERE $timeFilter AND spread("value") < 50 GROUP BY time(1d) fill(null)