I have a point shapefile layer with several thousand points. Each record has a timestamp field and another field which defines a category to which that record belongs. There are about 200 different categories. Is there a way to generate a query to select the first point of each category? A solution that sets a flag in a new calculated field would work, and then a query could be made based on that field.

1 Answer 1


You can use select by expression with this expression - or you can use the expression as a condition in a larger expression:

time = array_min (array_agg ( time, group_by:=category))

time and category are the names of the corresponding attributes: replace these to match the names you have.

enter image description here


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.