I have a QGIS project and I want to generate a report out of this. I am using the report-tool (https://docs.qgis.org/3.16/en/docs/user_manual/print_composer/create_reports.html) as it suits me better than the atlases. I defined my pages via HTML documents and iterated through the corresponding QGIS layer using the field group section.

So far, so good, but now I would like to additionally add a summary table at the beginning of the report, showing 1 row per entry (in this summary table), i.e. I need to

  1. Access the values of my QGIS layer within the HTML (which works well for the field group section, but does not seem to work in a static section), and then
  2. Create a HTML expression which iterates through every entry of my QGIS layer and adds an additional line to the summary table.

Unfortunately, I am already stuck with the first challenge...

  • You may add attribute tables to your report. As far as I understand this is what you are looking for.
    – Erik
    Commented May 3, 2021 at 11:40
  • how can i do this? this might indeed help, but i couldn't figure out how
    – manumanul
    Commented May 3, 2021 at 12:12
  • thanks! but can I define the table style as i used to do before within my HTML frame? I mean there are some style adjustments possible within that form, but not so much as with HTML.. because otherwise it does not really resolve my problem...
    – manumanul
    Commented May 3, 2021 at 12:29
  • You didn't hint at such an issue before.
    – Erik
    Commented May 3, 2021 at 12:30

1 Answer 1


As Erik said in comment the attribute table migth suits your needs. The styling option is limited compare to html table but very easy to do it related to your data.

In the layout, go to panel report organaizer and select your group. Then check include header and hit Edit button. It opens a new page that will be included before your group of pages.

enter image description here

In this page add an attribute table. In the item property you will have to set the layer to be the same that is used for the group in the report. (If you want to link it automaticaly with your layer selected in the group you can activate the data defined overide with the expression @atlas_layername).

Then you click the Attributes... button to choose which field will be shown or not. If you want to add a column based on computed value for every features you can add a new row defined by expression. For example round ($length / 1000,2) || 'km' to add the length of your feature in km (only if you have lines).

enter image description here

Adjust the size and styling and sorting to get the result you want. Here is the documentation for attribute table.

Then to add a summary line there is not really a dedicated solution for that. You can do the same table as before, but this table will not look for features attribute but will look on aggregation on all the layer.

First you have to copy-paste your attribute table created before. For every column you will have to edit the attribute and transform "Your_field" to be aggregate(@layer_name, 'sum', "Your_field"). Example below for field LONGUEUR in my attribute table. You may find aggregate function possibility here or in the integrated help.

enter image description here

Then you will have to set the maximum row to one in the property and may be to display no header if you have your first table above. You can refresh the view or export a report to see how it is and adjust the option to suits your needs.

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.