Field calculator — Tool (QGIS)

In QGIS: Processing Toolbox › Vector table › Field calculator (native:fieldcalculator); menu: Attribute table › Field calculator, or Processing Toolbox › Vector table.

Settings that matter

  • Result field type: Decimal (double), Integer (32 bit), Text …
  • Aggregate expressions summarise over groups: count($id, group_by:="cluster_id"), sum($area, group_by:="cluster_id").

Watch out

  • $area and $length are in the units of the layer’s CRS (or the project’s ellipsoid settings in the attribute table): check that they are m² and m.

Checked in QGIS 4.2.2, October 2026. Names and options can differ in other versions.