Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
GHasan
Contributor III
Contributor III

Distinct values from 3 different columns into 1 column

Hi, Is there a way to show distinct values of 3 different columns from 3 tables into 1 column? For example:

Table 1: 
Name      ID
    A             1


Table 2:
Name      ID
    A             3

Table 3:
Name      ID
    A             5

I want to show it in a table where it shows the distinct values of all IDs from all tables 

ID
 1
 3
 5

 

Labels (4)
4 Replies
Taoufiq_Zarra

@GHasan  can you elaborate

the example you posted here
3 table with same column name
so automatically the three tables are concatenated

so one table with the expected output

Taoufiq_Zarra_0-1660764931362.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
GHasan
Contributor III
Contributor III
Author

Hi Taoufiq, 

Something like this: 

Table 1: 
Name      Group X
    A             1
    B             2


Table 2:
Name      Group Y
    A             3
    C             2

Table 3:
Name      Group Z
    B             4

I want a distinct list of groups that the names belong to (1,2,3,4)

So the final list will show: 

Group All
     1
     2
     3
     4

I hope that helps. Please let me know if you have any questions.

sidhiq91
Specialist II
Specialist II

@GHasan  Please use the below script:

NoConcatenate
Temp:
Load * Inline [
Name,ID
A,1];

Concatenate(Temp)
Temp1:
Load Name,
ID

Inline [
Name,ID
A,1
A,3
]
where not Exists(ID,ID);


Concatenate(Temp)
Temp2:
Load * Inline [
Name,ID
A,1
A,3
A,5
]
where not Exists(ID,ID);

Exit Script;

Hope it resolves your issue, if yes please like and accept it as a solution.

Timario
Contributor III
Contributor III

Hi. 

Try next

Table_1: 

Load
Name ,   

 Group X as Group
from(resident) source


Table_2:

concatenate (Table_1)
Name ,

Group Y as Group
from(resident) source

Table_3:

concatenate (Table_1)
Name,     

Group Z as Group
from(resident) source

Load distinct Group as [Group All]

resident Table_1;