I'm working with population data, and I have an issue when it comes to knowing the sum of a population inside the attribute table. In my attribute table, I'd like to add all the numbers in the red box. I'd like to add all the numbers together from the column UN_2015_E. Is there a way to do so?

up vote 0 down vote accepted

An other possibility with the merge tool :

enter image description here

enter image description here

  • @Guillaume, be careful with a Merge Selected Features tool since it does not work with points in case you have population data for georeferenced addresses. – Taras Nov 8 at 14:16

There are several methods that I may refer you to:


1. First one is called "Show statistical summary". Symbolized as a Sigma symbol(Sigma), placed in the main QGIS working window.

Show_statistical_summary

In the appearing window, you just need to choose the layer which you are interested in (population data) and choose the field that you want to explore, seems like "UN_2015_E". The total number will be calculated just in the row called 'Sum'.

The same result can be achieved with View > Statistical summary

Or as it was already mentioned by @Erik you can proceed with View > Panels > Statistics Panel


2. There is a plugin called Group Stats, see the image below.

Group_Stats

However, I apply this plugin when I require some calculations to be exported, but I do not want to launch Excel.


3. If you open the Attribute table and put the layer in edited mode, then you will be able to type sum("UN_2015_E") in the Expression dialogue and get the result as an Output preview.

In case if you are dealing not with integer values your expression can be altered as round(sum("UN_2015_E"),0)


4. With a hint from @J.R, there is also a possibility with a Virtual layer through Layer > Add Layer > Add/Edit Virtual Layer.

In the Query panel, you just need to type a short statement, see the image below.

SELECT SUM(UN_2015_E)
FROM Your_shapefile_name

Virtual_layer

In case of not integer values, you can adjust your query as following

SELECT ROUND(SUM(UN_2015_E))
FROM Your_shapefile_name

Add the statistics panel (view - panels - statistics panel) to your window layout and then let it show you the statistics of your column.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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