I am attempting to determine the ratio of a statistic to the area of corresponding geometry while accounting for outliers through a standard deviation filter.

While the QGIS Expression Editor provides a valid preview result, the final column is only populated by NULL values. From research this appears to be related to conversion between integer and real numbers. However, even with utilizing the to_real function, no valid final results are displayed.

WHEN  ( to_real( "VEHS" ) /  "ALAND" ) > (  stdev( to_real( "VEHS" ) /  "ALAND" ) * 4 )
THEN (  stdev( to_real( "VEHS" ) /  "ALAND" ) * 4 )
ELSE ( to_real( "VEHS" ) /  "ALAND" )  
Preview: 0.0056653206243049

Both VEHS and ALAND are integers that result in a real number. What is the proper way to set up this expression?


enter image description here

  • if you choose Output field type double/real, and give it more precision, say 5, (next to output field length) what happens?
    – Elio Diaz
    Feb 20, 2018 at 17:40
  • With output set to Decimal number (real) and precision set to 5 the resulting column only contains NULLS. Feb 20, 2018 at 17:49

1 Answer 1


I feel a little sheepish. The checkbox in the Expression Editor was set to Only Update 1 selected feature, as visible in the posted image. Turning this option off produced expected results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.