4

Is it possible to calculate two columns at once?

So what I mean is that we have different covers and lengths and I want a total length of "Cover A" after that a total length of cover tb and so on.

See that attached photo for the columns that I mean.

enter image description here

1

1 Answer 1

7

QGIS has an algorithm for that :

You have to select your layer, your category field (here "Cover") and the field to calculate statistics (here "Length"). It will create a new non-geographic layer with your categories and some new statistic fields as minimum, maximum, mean, sum, etc.


You can also do a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... with a SQL query :

SELECT
    "Cover",
    SUM("Length") AS total_length
FROM
    your_table_name
GROUP BY
    "Cover"

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.