Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

summing two fields

Hi All,

I have two tables  as shown bbelow:

Table A: Fields A,Fields B,Fields C,Fields D

Table B: Fields 1,Fields 2,Fields 3,Fields 4

I need to sum the value of

Fields B with Fields 2

Fields C with Fields 3

Fields D with Fields 4

how can i achieve this if i give common names its craeting sync tabels..is there any alternative..Please do help

Regards,

Prajna

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

There isn't any link between the two tables so you need to define it into your sum:

write in your expression:

Sum(Field B) + Sum(Field 2)

otherwise you must link the 2 tables.

its_anandrjs
Champion III
Champion III

Simply on expression write

Sum(Fields B) + Sum(Fields 2)

Sum(Fields C) + Sum(Fields 3)

Sum(Fields D)  + Sum(Fields 4)

swuehl
MVP
MVP

Maybe use common field names, but CONCATENATE your two tables.

its_anandrjs
Champion III
Champion III

I assume here that From Table A Fields A and From Table B Fields are the keys if they are unique then link this two tables or make join between then by checking the key

Eg:-

Table A:

Load

[Fields A] as ID,

[Fields B],

[Fields C],

[Fields D]

From location;

left join

Table B:

Load

[Fields 1] as ID,

[Fields 2],

[Fields 3],

[Fields 4]

From location;

adarsh_a
Contributor III
Contributor III

Hi,

Create a common key field in both tables and join them.Later you can apply the condition FieldA + Field1 while loading.

Eg:

Source1:

LOAD * INLINE [

    FieldA, FieldB,Key

    100, 200,1

    300, 400,2

];

Left Join


Source2:

LOAD * INLINE [

    Field1, Field2,Key

    400, 300,1

    200, 900,2

];

LOAD FieldA+Field1 as Sum1,

         FieldB+ Field2 as sum2

          Resident Source1;