In QGIS 3.16. I am using the Aggregate function to reduce the number of features in a layer. I am grouping by one field and I want to concatenate the others.

My actual data table is fairly large and the operation seems to be working for some of my fields, but for some fields, I get an error message related to the concatenation, and for the life of me I can't figure out why.

Here is a screenshot of my Aggregate setup for a truncated version of my table, with a few of the features that are having problems. I am grouping by the field "Complexe"; note that all output field types are set to String (Text) with a length of 100, so that is not the issue: enter image description here

This is the message that I get : enter image description here

Evaluation error in expression "concatenate("ID_CH","Complexe",TRUE,',')": Could not calculate aggregate for ID_CH. Execution failed after 0.86 seconds.

Here are the files if you'd like to try and reproduce the problem: https://drive.google.com/drive/folders/1nOV1dxZWzNiIg9F77brQ36Rcvoze8QSb?usp=sharing

  • please do not put text in your question as an image - this makes it unreadable for many users (including Google)
    – Ian Turton
    May 18, 2021 at 10:10
  • Hi Ian, I used the native 'add picture' function. Would it be better to post a link to the picture? Or is there another way of loading a picture onto SE? Sorry for the newbie errors, I'll get the hang of it...
    – pete
    May 18, 2021 at 10:38
  • You should copy and paste the actual text into the question
    – Ian Turton
    May 18, 2021 at 10:58

1 Answer 1


The string function raised 'Evaluation error' because it couldn't parse the input.

To overcome it wrap each of your fields into the to_string() function in the 'Source Expression'


and get the output


Also mind the length of the output field.

Additionally, before aggregation I may suggest checking the validity of geometry of your features, e.g. with the "Check Validity" or the "Geometry Checker Plugin". Otherwise you will face similar issues as I had:

geometry_1 geometry_2

and others...

  • 1
    Simple and effective. Thanks for patiently helping me see what was right in front of me but which I hadn't noticed! Also thanks for the plugin suggestions.
    – pete
    May 18, 2021 at 14:39
  • Always welcome!
    – Taras
    May 18, 2021 at 14:43

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.