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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
qliksensedlin
Contributor II
Contributor II

lookup field value based on multiple criteria

Hi,

I'm trying to implement something like a multi-column vlookup in Excel for my Qlik table. Here is the simplified scenario:

Column AColumn BColumn C
15A
16B
27C
28D

 

Criteria 1Criteria 2Target Column
14?
25?
36?

 

I need to fill in my target column by values from Column C based on the combination of values from criteria 1 and criteria 2 columns.  Criteria 1 and Criteria 2 correspond to my Column A and Column B in the fact table loaded.

I have tried with FieldValue function with FieldIndex to lookup Column C like this:

=FieldValue('Column C', FieldIndex('Column A', 1))

However, this works only if I have a single criterion to look up. How can I then look up Column C based on multiple criteria in both Column A and Column B?

In addition, how can I refer to the values of Column B and C in my expression? i.e.

=FieldValue('Column C', FieldIndex('Column A', Column B)) is not working

I'm looking for a way to solve this by chart function because I don't want to modify the existing data model.

Thank you.

Labels (2)
2 Replies
marcus_sommer
MVP
MVP

You could use a mapping for it, maybe something like this:

m: mapping load [Column A] & '|' & [Column B], [Column C] from t1;

load *, applymap('m', [Criteria 1] & '|' & [Criteria 2], 'default value') as Target from t2;


- Marcus

qliksensedlin
Contributor II
Contributor II
Author

Thanks Marcus.

I would prefer a chart solution instead of a script solution. Applymap may work, but not in my use case.