I am creating a field for a z-score of a particular attribute. This requires calculating the mean and the standard deviation for the attribute across all features. I've been using the statistics window to get the mean and standard deviation, copying them into a field, and then doing the calculations in a third field, but I feel like that's not very efficient. I can't find a way to calculate the mean using the field calculator and my scripting skills are pretty weak.


In the Field Calculator, you can use the following Aggregate functions:

  • Mean

    mean( "fieldName" )
  • Standard deviation

    stdev( "fieldName" )

Tested on QGIS 2.18

  • 1
    Hey, that's good to know about! Thanks for the updated answer on this. – Brian Jul 7 '17 at 20:19

Zonal statistics plugin could be used.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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