Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Hoowling
Contributor III
Contributor III

Linking two tables with key when values are missing

Hi community, 

Need help with an issue that's driving me crazy. 

I have two tables where scrap data and used quantity is stored: 

clipboard_image_0.png

As you can see, I do not have scrap occurencies every month, 201904 and 201907 there were no scrapping done. 
The link between the tables is Location&YearMonth (Key) - The two tables cannot be joined, this is just a simplied example of my issue. 

The resulting table looks like this: 

clipboard_image_1.png

As you can see, the data for 201904 and 201907 is not linked between the tables as there where no scrap in those months. 

The expected result is this: 

clipboard_image_2.png

How do I solve this problem? 

//Hoowling


Labels (2)
4 Replies
dplr-rn
Partner - Master III
Partner - Master III

Why dont you left join scrapped quantity table to Used quantity table? (Assuming Used quantity will always have data)
fact:
load
yearmonth
,location
,usedquantity
from xyz;
left join(fact)
load
yearmonth
,location
,scrappedquantity
from abc;
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

if you use simple join, you'll never lose rows

marcus_sommer

It's quite simple if you don't joined or associate the tables else just concatenate (respectively union in sql) them. This could be done directly which creates an asynchron table or you could put both quantities in a single field and adding another field which contained the value of 'Scrapped' respectively 'Used' to be able to differ your quantities.

- Marcus

Brett_Bleess
Former Employee
Former Employee

I know you said you did not want to Join things, here is a Design Blog post that could help I think:

https://community.qlik.com/t5/Qlik-Design-Blog/Don-t-join-use-Applymap-instead/ba-p/1467592

Couple others that might be handy as well:

https://community.qlik.com/t5/Qlik-Design-Blog/To-Join-or-not-to-Join/ba-p/1463102

https://community.qlik.com/t5/Qlik-Design-Blog/Concatenate-vs-Link-Table/ba-p/1467569

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.