I've already asked this question, but I didn't really get the answer I was expecting. I will then try to reformulate with added details: I am in the process of migrating an entire orchard mapping project from Manifold to QGIS. Manifold has been scripted (using VB) in a way that at the bottom of each map it has generated, it will calculate and display the total canopy area of the orchard with a breakdown per variety (see image below).

enter image description here

I want to replicate this with QGIS.

From my understanding, there are 3 fields in the attributes table of my polygon shapefile layer that could be useful:

  • KPIN: every orchard has his own KPIN number. An orchard is subdivided by blocks and each block that grows a different variety of fruit will have the same KPIN number as the orchard where it belongs.
  • Canopy area: this field will calculate (with the $area expression) the surface area of our blocks (polygons).
  • Variety: this field defines what variety is being grown within our blocks

I believe there should be an expression that could use the KPIN number to pull data from the attribute tables and get what I would like to achieve:

  • the total sum of the canopy area for my KPIN (orchard)
  • a breakdown of the canopy areas per variety that is grown within the orchard

What this expression would look like? And where should I insert my expression? Is it in the print composer, in a label?

2 Answers 2


You could add a table in the print composer. You can change the attributes of the table by adding and additional one with a custom expression of the type 'aggregate'. In your example you coud use 'sum(expression, group_by, filter)'

sum("Canopy area", "KPIN")

Should give you the Canopy area per KPIN

Then select to remove duplicates from the table (and make sure to remove columns that would make the rows unique) you should get a list of KPIN and their area (from the new column).


In Print Composer you can go to Layout and Add Attribute Table. In the Item Properties dialogue box, choose the table that contains the data that you want. You can select only those attributes that you wish to disclose. You can also choose to display the attributes of the data that is in view in the composer. That's a good option if you are creating an atlas.

  • Thank you Johanna for your quick reply. I've already tried to "play" with the "add attribute table" tool. Unfortunately, it is not suitable as I'm ending up with too many lines, where I'd like to have only one line showing the sum of the canopy areas.
    – Moe
    Sep 22, 2016 at 3:25
  • You can set the number of visible rows of your table. The default maximum is 30. That setting is under Feature Filtering.
    – Johanna
    Sep 22, 2016 at 6:02

Your Answer

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

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