Aggregate functions are not allowed in WHERE

Dear all

I am using grafana to graph a posgresql database. My table is coming from some vessel sensors.I am recording engine consumption & engine load & vessel speed.

On plotly I want to graph consumption in function of load (SFOC) but I want to not use the data during the vessel acceleration deceleration period.

My request should be :

< SELECT
dates AS “time”,
consumption
FROM mytable
WHERE
$__timeFilter(dates) AND stddev(vitesse)<0.5
GROUP BY 1
ORDER BY 1 >

however we can not use aggregate function in Where condition.
So I am seaching for a solution ? Create a new calculate colum on postgresql ?

in advance thanks

Bertrand

Why cant you and are you getting an error monsieur Bertrand? :smile: