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

Mapping in Sense

Hi, 

Need help.

I got a Tables as below and need to map country across. 

 

Table 1:

Code    Name

-------------------------

US         United States

CH        China

 

I need to compare the above fields to the below table to generate a new column 'Presence' - the final table will be as below

Table 2:

ID     Country               Sales      Presence

---------------------------------------------------

MX  Mexico                   50000       No

US  United States      60000      Yes

IN    India                       40000     No 

 

Could you please advise how to go with the same? Please understand this is a sample and I may need to scale the same to more rows. 

Thank you

Labels (1)
1 Solution

Accepted Solutions
sidhiq91
Specialist II
Specialist II

@ksasidhars  Please follow the below script to get the desired results.

NoConcatenate
Temp:
Load * Inline [
Code,Name
US,United States

CH,China

];

Right join (Temp)
Load ID as Code,
Country,
Sales
Inline [
ID,Country ,Sales
MX,Mexico,50000

US,United States,60000

IN,India,40000

];

Main:
Load *,
if(isnull(Name),'No','Yes') as Presence
Resident Temp;

Drop table Temp;

Exit Script;

If this resolves your issue,kindly like and accept it as a solution.

View solution in original post

2 Replies
sidhiq91
Specialist II
Specialist II

@ksasidhars  Please follow the below script to get the desired results.

NoConcatenate
Temp:
Load * Inline [
Code,Name
US,United States

CH,China

];

Right join (Temp)
Load ID as Code,
Country,
Sales
Inline [
ID,Country ,Sales
MX,Mexico,50000

US,United States,60000

IN,India,40000

];

Main:
Load *,
if(isnull(Name),'No','Yes') as Presence
Resident Temp;

Drop table Temp;

Exit Script;

If this resolves your issue,kindly like and accept it as a solution.

ksasidhars
Creator
Creator
Author

Thank you Sidhiq. 

I yet to try my actual requirement as we have a mix of Country code and names in the actual table - so join may not work - your solution is correct for the ask.