3

I have a field called "_mean" and I would like to remove the decimal part of all the values of that field.

I attach two pictures. One an example of my variable ("_mean") in the attribute table and another the type of variable which "_mean" is. I am trying doing something like this Remove decimal points from string field using field calculator but it does not work. My version of QGIS is 3.24.0.

In the example, I would like that my variable _mean takes a values of 710000 instead of 710000.000000000000000

enter image description here

enter image description here

2
  • 5
    Are you asking how to create a new field using to_int() or round()?
    – Erik
    Commented Apr 13, 2022 at 11:06
  • Thank you for your comment @Erik. I do not know what is to_int() or round(). I am new in QGIS
    – OgeiD
    Commented Apr 13, 2022 at 13:25

2 Answers 2

8

You can use the Field Calculator to create a new field with Precision = 0. Setting your expression to "_mean" will carry through the values to your new field.

enter image description here

1
  • Thank you! It works!
    – OgeiD
    Commented Apr 13, 2022 at 13:27
2

Alternatively, you can also use the round function, which in this case could look like:

round(0)

where 0 means, that no decimals are to be returned

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.