Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

chrisbalmer
New Contributor

how to avoid sum of field values when joining two tables with identical fields

Hi

I have two tables which I want to join but without summing the values (red). Instead it should just be updated (green). How to do that? Many thanks for your help.

Tags (1)
1 Solution

Accepted Solutions
vishsaggi
Esteemed Contributor III

Re: how to avoid sum of field values when joining two tables with identical fields

Try this:

Table1:

LOAD * INLINE [

TimeStamp1, F1, F2

01.01.2016,1,2

02.01.2016,1,2

03.01.2016,1,2

];

Table2:

LOAD * INLINE [

TimeStamp1, F1, F2

02.01.2016,2,11

03.01.2016,2,11

04.01.2016,2,11

];

NoConcatenate

Final:

LOAD TimeStamp1,

     Max(F2) AS F2,

     Max(F1) AS F1

Resident Table1

Group By TimeStamp1;

Drop Table Table1;

Capture.PNG

2 Replies
antoniotiman
Honored Contributor III

Re: how to avoid sum of field values when joining two tables with identical fields

Hi Cristoph,

LOAD * Inline [
Timestamp,F1,F2
02/01/2016,2,11
03/01/2016,2,11
04/01/2016,2,11]
;
Concatenate LOAD * Inline [
Timestamp,F1,F2
01/01/2016,1,2
02/01/2016,1,2
03/01/2016,1,2]

Where not Exists(Timestamp);

Regards,

Antonio

vishsaggi
Esteemed Contributor III

Re: how to avoid sum of field values when joining two tables with identical fields

Try this:

Table1:

LOAD * INLINE [

TimeStamp1, F1, F2

01.01.2016,1,2

02.01.2016,1,2

03.01.2016,1,2

];

Table2:

LOAD * INLINE [

TimeStamp1, F1, F2

02.01.2016,2,11

03.01.2016,2,11

04.01.2016,2,11

];

NoConcatenate

Final:

LOAD TimeStamp1,

     Max(F2) AS F2,

     Max(F1) AS F1

Resident Table1

Group By TimeStamp1;

Drop Table Table1;

Capture.PNG