# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
New Contributor III

## Create a new field from two existing ones?

Hi!

I have "field 1" and "field 2" in one table, I wand to take the sum from "field 1" and divide it with the sum of "field 2" and create "field 3" from it (wich should be the result of dividing the two others).

Table looks like this

 ID Field 1 Field 2 (non existing field 3) 0113010031 13986 74 189 0113010031 15403,5 81,5 189 0113010031 19561,5 103,5 189 0113010031 23642,5 122,5 193 0113010031 24570 130 189 0113010031 24759 131 189 0113010031 28633,5 151,5 189 0113010031 28728 152 189 0113010031 29072 158 184 0113010031 29106 154 189 0113010031 29239,5 151,5 193 0113010031 30204,5 156,5 193 0113010031 31279,5 165,5 189 0113010031 32130 170 189 0113010031 33485,5 173,5 193 0113010033 2798,5 14,5 193 0113010033 4347 23 189 0113010033 12641,5 65,5 193 0113010033 23530,5 124,5 189

1 Solution

Accepted Solutions
Contributor II

## Re: Create a new field from two existing ones?

Try this:

ID,

[Field 1],

[Field 2],

[Field 1]/ [Field 2]   as [Field 3]

FROM test.qvd;

So it would be equal to the table you showed us before, now if you want to have a record by ID, with the sum of field 1, the sum of field 2 and finally field 3 (sum (field1) / sum (field2)) would be as follows:

[Field 1]/ [Field 2]   as [Field 3] ;

ID,

sum([Field 1]) as [Field 1],

sum([Field 2]) as [Field 2]

FROM test.qvd

group by ID;

Regards!!!

5 Replies
New Contributor III

## Re: Create a new field from two existing ones?

Try this:

ID from original table,

sum(field1) / sum(field2) as field3

resident original table

group by ID;

Contributor III

## Re: Create a new field from two existing ones?

Tab1:

ID,

Field1,

Field2

from Db;

sum(Field1)/(Field2) as field3

resident Tab1 group by ID;

Use like this

-Somasundaram
Honored Contributor II

## Re: Create a new field from two existing ones?

It doesn't look like you re summing them as the out put are different for one id

Load  * , [Field 1]/[Field 2] as field3;

ID, [Field 1], [Field2]

from Table_name;

Learning never stops.
Contributor II

## Re: Create a new field from two existing ones?

Try this:

ID,

[Field 1],

[Field 2],

[Field 1]/ [Field 2]   as [Field 3]

FROM test.qvd;

So it would be equal to the table you showed us before, now if you want to have a record by ID, with the sum of field 1, the sum of field 2 and finally field 3 (sum (field1) / sum (field2)) would be as follows:

[Field 1]/ [Field 2]   as [Field 3] ;

ID,

sum([Field 1]) as [Field 1],

sum([Field 2]) as [Field 2]

FROM test.qvd

group by ID;

Regards!!!

Highlighted
New Contributor III

## Re: Create a new field from two existing ones?

thanks to everyone for helping out!