Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Complex Where Clause

Need some help with a WHERE clause - Cant seem to get it right.

I have the follows LOAD script that returns the attached screen shot.

LOAD COUNTRY, YEAR, DATA_SOURCE, AMOUNT

FROM

FILE.qvd

(qvd)

where                     trim(VIEWID) = 'ABC'

                    and (ACCOUNT = '100' or ACCOUNT = '101' or ACCOUNT = '102' or ACCOUNT = '103')

                    and Exists([COUNTRY],           ApplyMap('BU_TBL_MAP',                     COUNTRY,                              COUNTRY));

Im trying to exclude 2010/2011 data for Ireland since I dont want it coming through into the app.  What will the new WHERE clause be?

Thanks, Jay

1 Solution

Accepted Solutions
Not applicable
Author

This perhaps?

In the statement below, I marked in the comment where I added things. It does this:

It excludes Ireland when the year is 2010 or 2011. So Data for Ireland in 2012 will still be visible

LOAD

COUNTRY,

YEAR,

DATA_SOURCE,

AMOUNT

FROM

FILE.qvd

(qvd)

where                 

trim(VIEWID) = 'ABC'

                  

and (ACCOUNT = '100' or ACCOUNT = '101' or ACCOUNT = '102' or ACCOUNT = '103')

and Exists([COUNTRY],ApplyMap('BU_TBL_MAP',COUNTRY, COUNTRY))

//statement below  is added

and not(COUNTRY= 'Ireland' and ( YEAR=2010 OR YEAR=2011))

;

Hope it helps.

View solution in original post

3 Replies
Not applicable
Author

Hi, one way would be:

where (COUNTRY<>'Ireland' or (YEAR <>2010 and YEAR<>2011));

Not applicable
Author

This perhaps?

In the statement below, I marked in the comment where I added things. It does this:

It excludes Ireland when the year is 2010 or 2011. So Data for Ireland in 2012 will still be visible

LOAD

COUNTRY,

YEAR,

DATA_SOURCE,

AMOUNT

FROM

FILE.qvd

(qvd)

where                 

trim(VIEWID) = 'ABC'

                  

and (ACCOUNT = '100' or ACCOUNT = '101' or ACCOUNT = '102' or ACCOUNT = '103')

and Exists([COUNTRY],ApplyMap('BU_TBL_MAP',COUNTRY, COUNTRY))

//statement below  is added

and not(COUNTRY= 'Ireland' and ( YEAR=2010 OR YEAR=2011))

;

Hope it helps.

Not applicable
Author

Very good...didnt know about the NOT statement.

Jay