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

2 Tables Join Issue

I need to combine 2 Tables Data.

Table1:

LOAD * inline [

Material| Type

M1|abcd

] (delimiter is '|');

 

Table2:

LOAD * inline [

Material|Unit|Unit2

M1|EA|IN_EA

M1|IP|IN_IP

M1|MP|IN_MP

] (delimiter is '|');

 

Output is coming as below:

Vasu2_0-1675407065393.png

 

Expected output is:

Material

IP UOM

MP UOM

EA UOM

M1

IN_IP

IN_MP

IN_EA

 

IP_UOM  =if(Unit='IP’,Unit2)

EA_UOM =if(Unit='EA',Unit2)

MP_UOM =if(Unit='MP',Unit2)

 

I tried all the joins(Left, Right and Inner) but none of them is working.

Any suggestions?

Labels (4)
3 Solutions

Accepted Solutions
vinieme12
Champion III
Champion III

Wrap the Calculated Dimensions in AGGR()

 

IP_UOM  =  Aggr(  MaxString({<Unit={'IP'}>} Unit2) , Material )

EA_UOM  =  Aggr(  MaxString({<Unit={'EA'}>} Unit2) , Material )

MP_UOM  =  Aggr(  MaxString({<Unit={'MP'}>} Unit2) , Material )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

Vasu2
Contributor II
Contributor II
Author

Thanks Vineeth For reply.

This fix is working perfectly.

View solution in original post

vinieme12
Champion III
Champion III

as below

 


temp_Table2:

LOAD * inline [

Material|Unit|Unit2

M1|EA|IN_EA

M1|IP|IN_IP

M1|MP|IN_MP

] (delimiter is '|');

Load Material
,MaxString(if(Unit='IP’,Unit2)) as IP_UOM
,MaxString(if(Unit='EA’,Unit2)) as EA_UOM
,MaxString(if(Unit='MP’,Unit2)) as MP_UOM
Resident temp_Table2
Group by Material;

Drop table temp_Table2;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

4 Replies
vinieme12
Champion III
Champion III

Wrap the Calculated Dimensions in AGGR()

 

IP_UOM  =  Aggr(  MaxString({<Unit={'IP'}>} Unit2) , Material )

EA_UOM  =  Aggr(  MaxString({<Unit={'EA'}>} Unit2) , Material )

MP_UOM  =  Aggr(  MaxString({<Unit={'MP'}>} Unit2) , Material )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Vasu2
Contributor II
Contributor II
Author

Thanks Vineeth For reply.

This fix is working perfectly.

Vasu2
Contributor II
Contributor II
Author

Hi Vineeth,

After combing the 10 Tables data we want to this data exported to some location.

hence we are combing all this data into one single table.

can we do this Aggregation at script level? if yes, can you share some example code please?

Thanks in Advance.

 

vinieme12
Champion III
Champion III

as below

 


temp_Table2:

LOAD * inline [

Material|Unit|Unit2

M1|EA|IN_EA

M1|IP|IN_IP

M1|MP|IN_MP

] (delimiter is '|');

Load Material
,MaxString(if(Unit='IP’,Unit2)) as IP_UOM
,MaxString(if(Unit='EA’,Unit2)) as EA_UOM
,MaxString(if(Unit='MP’,Unit2)) as MP_UOM
Resident temp_Table2
Group by Material;

Drop table temp_Table2;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.