Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
43918084
Creator II
Creator II

Outer Join creates duplication in one table

I have created an Outer Join with Group by so that the values of 2 tables are included. However, it has created duplication. Hope I could get advice to resolve it.
 
Hope I can get some guidance.  Many thanks in advance.
 
Script
table:
Load
Arr Lcl Num Ath,
sum "ytd Bal" as t0_Bal
From Table t0 Group by Arr Lcl Num Ath;
 
Outer Join
 
Load
Arr Lcl Num Ath,
sum "ytd Bal" as t1_Bal
From Table t1 Group by Arr Lcl Num Ath;
 
Capture.PNG
Labels (1)
3 Replies
mjht
Creator
Creator

why do you need to join?  t0 and t1 have same fields and will concatenate into Table.  

Table1:
Load
Arr Lcl Num Ath,
"ytd Bal" as Bal
From Table t0 ;
 
Load
Arr Lcl Num Ath,
"ytd Bal" as Bal
From Table t1 ;
 
 
Table2:
Load 
Arr Lcl Num Ath,
sum(Bal) as Balance
Resident Table1
Group by Arr Lcl Num Ath;
 
drop table Table1;
43918084
Creator II
Creator II
Author

 I need to do  comparison for other fields between these 2 tables like below.  Sorry I ve made the table simpler for easy understanding.

 

RESULTt1 Staget0_Staget1_Balt0_BalStage compareBal Diff
580009283900001000000121811Up7
58000928390000600000053500Down50

 

Table1:
Load
Stage as t0_Stage,
Arr Lcl Num Ath,
"ytd Bal" as Bal
From Table t0 ;
 
Load
Arr Lcl Num Ath,
"ytd Bal" as Bal
From Table t1 ;
 
 
Table2:
Load 
Stage as t1_Stage
Arr Lcl Num Ath,
sum(Bal) as Balance
Resident Table1
Group by Arr Lcl Num Ath;
 
drop table Table1;
mato32188
Specialist
Specialist

Hi @43918084 ,

have you checked you do not have duplicated key field values? Just to be sure, try to use Load distinct and check whether it could help you or not.

BR

m

ECG line chart is the most important visualization in your life.