2

enter image description here

I have multiple shapefile layers of a city with its districts that have the same shape and information, only the last two columns are different (The picture shows one of the three attribute tables).

Now I want to add up the last column (contains numbers from 1-5) of each shapefile and write the result in a new layer that has the same shape. I thought about using "Merge vector layers" and then using the Field Calculator to sum up the columns but the algorithm adds new rows with the districts so I end up with three times as many districts whereas I need three new columns with the numbers so I can add them up.

1
  • I added a picture and changed the text, hope its a bit clearer now. In the attribute tables are columns with names and also columns with IDs.
    – Tim
    Sep 5, 2020 at 8:34

1 Answer 1

3

You can use a table join, see the documentation. Add the attributes to one of the three layers - of save a copy of one of the layers and then join the attributes to this one. Once you have the attributes joined, use the field calculator to add them.

An alternative would be to create a virtual layer by selecting the geometry and the relevant attributes from the different layers and than add it up in the virtual layer.

Your Answer

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

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