There are several approaches that I may suggest:
Approach 1 : toolbar
"Show statistical summary" tool from the Statistics panel (Ctrl+6).
Symbolized as a Sigma symbol(), placed in the main QGIS working window, and belongs to the Attributes Toolbar.
In the appearing window, one needs to choose the required layer (population data) and choose the field that has to be explored, seems like
"UN_2015_E". The total number will be calculated just in the row called
The same result can be achieved with
View > Statistical summary.
Or as it was already mentioned by @Erik
View > Panels > Statistics Panel.
Approach 2 : field-calculator
Field Calculator with the following expression
sum("UN_2015_E") in the Expression dialogue to get the result as a Preview.
In case rounded values are needed, the expression must be altered into
Approach 3 : virtual-layer sql
With a hint from @J.R, there is also a Virtual layer through
Layer > Add Layer > Add/Edit Virtual Layer.
In the Query panel, a short statement has to be pasted, see the image below:
To achieve rounded values, one can adjust the query like:
Approach 4 : pyqgis python
Plugins > Python Console (Ctrl+Alt+P) and the following command:
aggregate() method of the
QgsVectorLayer class for more details.
Another option is using native Python functions to calculate the sum of all
NOT NULL values with a filter:
print(sum(filter(None,[f['UN_2015_E'] for f in qgis.utils.iface.activeLayer().getFeatures()])))
Additionally, one can also refer to a layer by its name:
print(sum(filter(None,[f['UN_2015_E'] for f in QgsProject.instance().mapLayersByName('Layer_Name').getFeatures()])))
Approach 5 : qgis-processing
QGIS domestic statistical geoalgorithm "Basic statistics for fields" in the Processing Toolbox (Ctrl+Alt+T).
Choose the field
"UN_2015_E" and get the result as
Approach 6 : saga qgis-processing
The SAGA's "Field Statistics" tool, which will calculate the sum as one of the parameters.
Approach 7 : qgis-plugins
QGIS's Plugin called "Group Stats".