Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
wcilliers
Partner Ambassador
Partner Ambassador

Exclude All except some

Hi All,

I have two scenarios that I need help with.

Scenario 1:

I need to exclude billing types A and B, but only from 01/04/2017, all transactions before that still has to be included. Preferably, I dont want to load twice if it is not necessary, was hope there is an easy way to structure the where clause....

Scenario 2:

I need to exclude all ITEMCODES starting with ABC, except ABC1, ABC4, ABC12.

Again, I would like to do this in a where clause if possible.

Any help would be greatly appreciated.

Thanks,

Wynand

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Wynad,

Try something like below..

Scenario 1:


Load *

From

Source

Where (Date >= '01/04/2017' And Not Match([Billing Type],'A','B') ) OR (Date <'01/04/2017') ;

Scenario 2:


Load *

From

Source

Where Wildmatch(ITEMCODES, 'ABC*) And Not Match(ITEMCODES,'ABC1','ABC4','ABC12');

View solution in original post

4 Replies
Anil_Babu_Samineni

Scenario-1:

May be this?

Load * From Table Where Not Match([billing types],'A', 'B') and Transactions = '01-04-2017';

or

Load * From Table Where [billing types] <> 'A' and [billing types] <> 'B' and Transactions = '01-04-2017';


Scenario-2:

You need except ABC1 ... But, You have starting with ABC only. Would you provide some inputs may be data and tell us result you want to see

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tamilarasu
Champion
Champion

Hi Wynad,

Try something like below..

Scenario 1:


Load *

From

Source

Where (Date >= '01/04/2017' And Not Match([Billing Type],'A','B') ) OR (Date <'01/04/2017') ;

Scenario 2:


Load *

From

Source

Where Wildmatch(ITEMCODES, 'ABC*) And Not Match(ITEMCODES,'ABC1','ABC4','ABC12');

wcilliers
Partner Ambassador
Partner Ambassador
Author

Hi Tamil,

Thank you.

Scenario 1:

I added the OR part which forgot to add initially and it now works. Thanks!

Scenario 2:

Has to be the other way around.

I swapped it around a bit and used your logic from Scenario 1 and it works...

Where

Match(ItemCode,'ABC1','ABC4','ABC12')

OR

NOT Wildmatch(ItemCode, 'ABC*')

Thanks for the help All!!

Much Appreciated!

tamilarasu
Champion
Champion

Great Wynand!! Have a good day!