# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for
Did you mean:
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
Creator II

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
Contributor III

Try this:

ID from original table,

sum(field1) / sum(field2) as field3

resident original table

group by ID;

Creator III

Tab1:

ID,

Field1,

Field2

from Db;

sum(Field1)/(Field2) as field3

resident Tab1 group by ID;

Use like this

-Somasundaram
Master II

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.
Creator II

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!!!

Contributor III
Author

thanks to everyone for helping out!

Community Browser