6

I'm using QGIS and I need an expression to change an attribute each X number of rows. For instance I have the next attribute data:

enter image description here

I want to create an attribute (C) that assigns an ordered value each 3 rows. With the next result:

enter image description here

9

Assuming your rows are already sorted, you just have to create a new integer field with the expression: ($rownum + 1) / 3

  • Thanks a lot. That was exactly what I needed and I didn't figure it out :-( – César Arquero Aug 29 '17 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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