Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using WHERE with AND clause

Hello,

I am trying to use a WHERE clause with an AND clause to achieve the following:

Actual Volume should only be loaded if >= 0.

No data should be loaded if Forecast and Actual both = 0.

I have tried the following but it seems to eliminate records where Forecast = 0 but Actual does not.

WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' AND [Forecast Volume]<> '0');

I'm not sure if I'm perhaps using AND incorrectly or misplacing my ().

Thanks for your help!

M

1 Solution

Accepted Solutions
cwolf
Creator III
Creator III

Hello,

you can take:

WHERE [Actual Volume] >='0' AND NOT ([Actual Volume] = '0' AND [Forecast Volume] = '0');


which is the same as:


WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' OR [Forecast Volume] <> '0');


Regards

Christian

View solution in original post

5 Replies
its_anandrjs

Use for Actual data to be load

Load * From Source

WHERE [Actual Volume] >= 0

Or

Load * from Source

Where ([Actual Volume] <> 0 AND [Forecast Volume]<> 0);

Regards

Anand

cwolf
Creator III
Creator III

Hello,

you can take:

WHERE [Actual Volume] >='0' AND NOT ([Actual Volume] = '0' AND [Forecast Volume] = '0');


which is the same as:


WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' OR [Forecast Volume] <> '0');


Regards

Christian

ThornOfCrowns
Specialist II
Specialist II

WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' is a contradiction. The first part checks for greater or equal to 0 and the secend part checks for not equal to 0. If the condition is 0 your AND cannot resolve itself.

its_anandrjs

Hi,

You can try different way also by this expression load where condition in two different table and then concatenate those

MainTable:

Load * From QVD

Where [Actual Volume] <> 0 AND [Forecast Volume]<> 0;


Concatenate


Load * From QVD

Where [Actual Volume] >=0;

Regards,

Anand

Not applicable
Author

Thanks, Christian!

WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' OR [Forecast Volume] <> '0'); seems to work as anticipated