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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kevbrown
Creator II
Creator II

Exclude Records

Hi,

I am bringing in 2 tables to QlikView and concatenating them, However some of the records in the second table are already in the first table and I need to exclude them

So I have a "Revenue" table with Name, Date, Product and "Transaction Number" with values 1, 2, 3, 4, 5, 6

and a second table "Revenue 2" with the same fields with values Transaction Numbers of 2, 5, 7, 8

I don't want Transactions 2 and 5 from "Revenue 2" table to concatenate to the "Revenue" table

Easy fix?

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Easy to do in QV. I'm using dummy code, the magic is in the Exists() function call:

// Load everything from Revenue1 source


[Revenue]:

LOAD * FROM [DataSourcePath1] (options); // Includes a field called TransactionID

// Add Revenue2 - omit existing Transactions by checking field TransactionID

CONCATENATE (Revenue)

LOAD * FROM [DataSourcePath2] (options)

WHERE Not Exists(TransactionID); // Won't load existing TransactionID rows

Best,

Peter

View solution in original post

4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Easy to do in QV. I'm using dummy code, the magic is in the Exists() function call:

// Load everything from Revenue1 source


[Revenue]:

LOAD * FROM [DataSourcePath1] (options); // Includes a field called TransactionID

// Add Revenue2 - omit existing Transactions by checking field TransactionID

CONCATENATE (Revenue)

LOAD * FROM [DataSourcePath2] (options)

WHERE Not Exists(TransactionID); // Won't load existing TransactionID rows

Best,

Peter

Peter_Cammaert
Partner - Champion III
Partner - Champion III

For more information on the Exists() function, see: Exists ‒ QlikView

kevbrown
Creator II
Creator II
Author

Thanks that worked perfectly.  On the same lines, what if I had a list in excel of the Transaction Numbers that I would like to exclude. from the second table so they don't feed into the first table?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Best (and quickest) way to handle variable exclusion lists is to load your Excel list in a MAPPING table before loading the second part of the available transactions. The Exists() call gets replaced by a call to applymap() that returns a selected value (by you) for every record that needs to be excluded. Add some glue logic and you're set.

Info on Mapping and the use of applymap(), see here: Mapping ‒ QlikView