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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Vlookup expression


Hi,

I am looking for a solution that will mimic a Vlookup in excel.

I have created a unique key within a table as an expression (has several caluculations looking at different tables).  I have an excel table loaded into Qlikview that has the key and a 'value' as a seperate column.  I am essentially trying to show the value from the excel table rather than my calculated key.

I have tried a simple 'if' statement

if (   expression = 'Excel Key', 'Excel Value' , Null() )

However no value is being returned.

I am sure I have resloved this before in the past however I cannot remember how I managed it (this needs to be done in a table and not the load script).

I would be very grateful for any advice.

Thanks in advance

11 Replies
Not applicable
Author

Hi Clark,

I think I have found the issue.  The main key is generated by using 'Key & Code', the 'Code' part is made up from a nested 'if' statement that includes 'Sum'.  Although all of this works in isolation to generate the correct key, as soon as I add it as part of the overall expression it generates an error.

I have attached an updated example to demonstrate.

Do you (or anyone else) know of a way I can preserve the sum if statement whilst getting the lookup to work?

Cheers

 

Anonymous
Not applicable
Author

Hello, Edward.

QlikView has a Lookup() function. It should do just what you need. Take a look: Lookup function, Joins and Lookups

If you don't use Lookup(), you'll need to use the Aggr() function. It allows you to make nested aggregations. It's needed becaouse the long if statement that generates the key uses Sum(). To help you with it, we'll need a more detailed sample qvd, one that is more close to your actual app.

Hope it helps.