I'm a new user trying to perform very simple operation but I'm completely stuck. I'd like to be able to select a number of features on the map and then get the sum of a particular field for only the selected features, on the fly. For example, summing the population fields for a number of counties that I've selected on the map. I don't need to store the sum in any way, I just need to quickly get it for reference.

  • That sounds like it would be a useful feature, but I don't think it exists in QGIS, at least not without writing code for it yourself. The fastest other way I can think of is to copy the selected features and paste into a spreadsheet.
    – csk
    Mar 23, 2018 at 18:33
  • Actually, it looks like there is a way to do this, using the "show statistical" button on the attributes toolbar. I'll post this as an answer as soon as my computer stops being slow.
    – csk
    Mar 23, 2018 at 18:39
  • Thank you. I think you're right. QGIS 3 has an "execute SQL" function that seemed promising, it looks like it isn't strictly for queries/selection as it can apply a SQL operation to only the selected features. But I'm using QGIS 2 for this project because there's way more information online. Mar 23, 2018 at 18:46
  • This is what I love about stack exchange. I didn't know this feature existed until I read this question and went looking for it. Now that I know it exists I'm sure I'll use the stats panel all the time.
    – csk
    Mar 23, 2018 at 18:52

1 Answer 1


The Statistics Panel displays various calculations based on a field.

  • To open the Statistics Panel, click the epsilon button in the Attributes toolbar.
  • Select the layer from the dropdown menu at the top of the stats panel.
  • Select the field from the dropdown menu below that.
  • At the bottom of the panel, check the box for "selected features only." Otherwise statistics are calculated for all features in the layer.
  • To choose what types of stats are calculated, use the "..." button at the bottom-right of the panel.

enter image description here

Screenshot is from QGIS 2.18. The stats panel also exists in QGIS 3.0.

  • Please use the check mark next to the answer to accept it. This way other people with the same question will know that this answer is correct.
    – csk
    Mar 23, 2018 at 18:58
  • Note: If you want to sum, for example Area (which hasn't been pre-calculated in an attribute table), you'll need to set the Field Selector/Expression dialog to something like $area. This will give you a summary of the area in the CRS' base unit.
    – Tim
    May 11, 2022 at 20:12

Your Answer

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

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