[Qgis-user] Problems with attribute data

Anita Graser anitagraser at gmx.at
Fri Jun 12 02:08:57 PDT 2015


On Fri, Jun 12, 2015 at 10:18 AM, Sebastian Andersson <
sebastian_andersson at hotmail.com> wrote:

> Hello,
>
> I want to calculate the share of different population Groups in my
> attribute table by using the field calculator.
> I have added a new column in the attribute table and calculated the share
> of young people, by dividing the number of young people with the total
> number of people.
> The new values are added to the new column. However, after saving, the
> values are lost and the columns show 0. Why?
>

Try

1.0 * young people / total people

The problem seems to be integer division which again results in an integer
value rather than the desired float value.

Best wishes,
Anita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150612/b0d09e05/attachment.html>


More information about the Qgis-user mailing list