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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
MT4T
Creator
Creator

Where clause issue

Hello,

I have an issue with proper filtering data table.

I have also asked chatGPT but he can't clear this.

I need filtered this table:

 1 I need only December 2022 and later included

 2 I need exclude any row with "COR" contained in field H_DOCUMENT_NUMBER

There is probably syntax error with stacking two where clauses but single try  with only excluding "COR" don't work as demand too.

LOAD
'SALES' as TABLE,
H_DOCUMENT_NUMBER as DOCUMENT_NUMBER,
CUSTOMER_ID,
MATERIAL as "FG Code",
//"Short model name" as "Short model",
H_TO_NET_EUR as "TO NET",
DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') as CAL_YYYY_MM,
TO_REGION


FROM [lib://QVD tabele:DataFiles/SCEP_ALL_AN_SALES.QVD]
(qvd) WHERE DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') >= '2022_12'
OR NOT H_DOCUMENT_NUMBER LIKE '%COR%';

Labels (2)
3 Replies
Vegar
MVP
MVP

Try this where statement
WHERE DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') >= date#('2022_12', 'YYYY_MM')
OR NOT (H_DOCUMENT_NUMBER LIKE '%COR%');

you can also try to replace your LIKE cause with a wildmatch() expression.

Wildmatch (H_DOCUMENT_NUMBER, '*COR*')=0;
vinieme12
Champion III
Champion III

Assuming the field DATE_UNLOADING is an actual date field

 

Where MONTHSTART(DATE_UNLOADING) >= makedate(2022,12,1) 

OR NOT H_DOCUMENT_NUMBER LIKE '%COR%';

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
MT4T
Creator
Creator
Author

I have tried both versions, but it seems as if this does not work as I need.

 

 

Concatenate (COMPARE)
LOAD
'SALES' as TABLE,
H_DOCUMENT_NUMBER as DOCUMENT_NUMBER,
CUSTOMER_ID,
MATERIAL as "FG Code",
//"Short model name" as "Short model",
H_TO_NET_EUR as "TO NET",
DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') as CAL_YYYY_MM,
TO_REGION


FROM [lib://QVD tabele:DataFiles/SCEP_ALL_AN_SALES.QVD]
(qvd)


WHERE DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') >= date#('2022_12', 'YYYY_MM')
OR NOT (Wildmatch (H_DOCUMENT_NUMBER, '*COR*')=0)

 

/*WHERE DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') >= date#('2022_12', 'YYYY_MM')
OR NOT (H_DOCUMENT_NUMBER LIKE '%COR%')*/;

 

After loading both are included. When I use below script for filtering data it filtered YYYY_MM in right way but this "COR" doesn't work with any modification. I attached app.

WHERE DATE(MONTHSTART(DATE_UNLOADING), 'YYYY_MM') >= '2022_12'

MT4T_0-1675239096180.png