In QGIS, I have a point layer. I'd like to create a new attribute that will retrieve the value from the "Name" field for the object that has the highest value in the "he" field in each "ID" group. What expression can I use?
- 1What have you tried so far?Taras– Taras ♦2025-10-17 10:01:20 +00:00Commented Oct 17 at 10:01
Add a comment |
1 Answer
The array_agg() function contains all you need. It takes all values form Name field, groups them by the value from ID field and filters the feature where the field he has the largest value:
array_agg ( "Name", group_by:="ID", filter:= "he" = maximum ("he", group_by:="ID") )[0] 
