Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

where condition with 'and','or' and not equal to combination working ?

Hi All,

Please let me know how not equal works in where condition works with and or operators.

Like I have two columns Region with entries AMS and Business Unit with entries 'PPS Commercial' and 'PPS Consumer'.

I don't need to load the data when Region = 'AMS' and Business Unit ='PPS Consumer'  & Region = 'APJ' and Business Unit ='PPS Consumer' .

I have written code like below

Load Region,

Business Unit

from

Sample.xlsx

where (   (Region<>'AMS' or Business Unit <>'PPS Consumer' )  and (Region<>'APJ' or Business Unit <>'PPS Consumer' ) );

It is working fine but not able to understand how it working correctly . Because as per my understanding it has to be "and "in the place of "or "and vice versa in the above expression.

Thanks in Advance ,

Sreehari Satheesan

3 Replies
MK_QSL
MVP
MVP

Load

     Region,

     Business Unit

From

Sample.xlsx

where Not (

     (Region='AMS' and Business Unit ='PPS Consumer')

     or 

     (Region = 'APJ'  and  Business Unit  = 'PPS Consumer' )

);

jonathandienst
Partner - Champion III
Partner - Champion III

Or a slightly simpler version

Where [Business Unit] <> 'PPS Consumer'  And Match(Region, 'AMS', 'APJ') = 0

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan and Manish,

The solution you suggested is not working correctly.

Actually I have another entries  in Region like EMEA and other entries in BU Unit like PPS Commercial , I need that fields to be retained

Actually I got the solution but I am not understanding how it is working .How not equal to is working when we use OR and AND functions. I have also thought or done like you  both before but it is not giving the expected result.

For your reference I am attaching the qvw with answer.