I want to sum and group some percentages as a part of a model in order to check whether the percentages are exactly 100, or if there is a small rounding error.

When using the field calculator outside the model, sum("percentage field","group field") works flawlessly as usual.

Since the name of the group field may change between summed up layers (the percentage field is created within the model), I want the user to provide said field name and use that input in my expression, giving me sum("percentage field",@user_input). This expression doesn't group the sum, but sums up all values - and I can't figure out how to make it work as intended.

1 Answer 1


you have to change your formula to precalculated value and then make a string representation of your formula like:

'sum("percentage field",'  ||  @user_input ||  ')'

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.