I have the following attribute table:

attribute table

on which there are points on different types of lands. Each land has a code that is in the CODE_00 field, I have calculated how many points there are in each of the lands in the NUMPOINTS field. How to calculate the total number of points in a land with code 311?

  • 4
    sum("NUMPOINTS", filter:="CODE_00"=311)
    – Taras
    Feb 22 at 16:03

2 Answers 2


You can use the "Statistics by categories" tool in the toolbox. Select the layer in which your data are (Count, I guess) and then select both the fields (attributes) you want the statistics be calculated from (NUMPOINTS) and the categories (CODE_00). Then just run the algorithm. The sum will be one of the values you'll get.


Using the Virtual Layers:

FROM csd
where CODE00 = 311
group by CODE00

Using the Virtual Layers:

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.