Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jessica_webb
Creator III
Creator III

Join table based on minimum values

Hello,

Apologies that I'm not able to provide any sample script, but I have no idea where to begin with this and can't find anything similar in the forums.

I would like to do the following in the script, as I believe it is more effective...

I have a very large table called TABLE_INFO with the following key fields (there are many other fields in addition to these):

Qual_predIs_AIs_BIs_CPrior_ABPrior_C
Spanish12834
Spanish13338
Spanish12027
English14354
English12927

I then have another table (TABLE_NEW) which I would like to join to TABLE_INFO, with the following fields:

Qual_predMinMaxOutcome
Spanish162033
Spanish212537
Spanish263040
Spanish313542
English182128
English222536
English262938

I need to do the following for every row in TABLE_INFO.

1) Look at the 'Qual_pred'.

2) If it is 'Is_A' or 'Is_B', use value 'Prior_AB' / If it is 'Is_C', use value 'Prior_C'

3) Look in TABLE_NEW and find matching 'Qual_pred'

4) If value 'Prior_AB' or 'Prior_C' (depending on step 2), falls between 'Min' and 'Max', return 'Outcome' value to TABLE_INFO

I would hope to end up with the following:

Qual_predIs_AIs_BIs_CPrior_ABPrior_COutcome
Spanish1283440
Spanish1333842
Spanish1202733
English1432336
French11729

Any help appreciated - even just a hint as to what direction I should go in!

Many thanks in advance,

Jess

10 Replies
jessica_webb
Creator III
Creator III
Author

Paul, that helps enormously - thank you so much!

I now have a single table of data, with the Outcomes matched in correctly.

For some reason I'm still getting duplicates in my worksheet table, showing nulls for outcome, e.g:

Qual_predIs_AIs_BIs_CPrior_ABPrior_COutcome
Spanish1283440
Spanish12834-
Spanish1333842
Spanish13338-
Spanish1202733
Spanish12027-
English1432336
English14323-

But I'm guessing that could be down to a fault somewhere else in my script... Hopefully it won't affect my calculations.

Thanks once again for your help.

Best wishes,

Jess