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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
YanivZi
Contributor III
Contributor III

Exclude values from resident

I am trying to exclude the math courses equal from Student after using subfield but I got error "StudentsExclude.%Key not exists". what i have done wrong?

Students:
LOAD
%Key,
FirstName,
LastName,
Courses, 
Gender,
BirthDay

RESIDENT FACT

StudentsALL:
%Key, 
SubField(Courses, ';') AS Course

RESIDENT Students
STORE StudentsALL INTO [lib://DEMO/StudentsALL.QVD](qvd);

StudentsExclude:
LOAD DISTINCT %Key
RESIDENT StudentsALL
WHERE Course= 'Math';

StudentsExcludeMath:
LOAD *
RESIDENT Students
WHERE NOT Exists(StudentsExclude.%Key);

STORE StudentsExcludeMath INTO [lib://DEMO/StudentsExcludeMath.QVD](qvd);

 

Labels (2)
3 Replies
Chanty4u
MVP
MVP

Change your load script 

StudentsExcludeMath:

LOAD *

RESIDENT Students

WHERE NOT Exists(%Key);

marcus_sommer

This: StudentsExclude.%Key indicates that any qualifying is applied. I suggest to remove it completely because it's very seldom an added value (only in specific cases for experienced users) else it will cause a lot of trouble.

Anders_Eriksson
Partner - Specialist
Partner - Specialist

Excluding the qualification will not solve the problem that is asked about.
Sure the script will run but exclude everything since every %Key already exists!
I suggest this;

StudentsExclude:
LOAD DISTINCT %Key as %ExcludeKey
RESIDENT StudentsALL
WHERE Course= 'Math';

StudentsExcludeMath:
LOAD *
RESIDENT Students
WHERE NOT Exists(%ExcludeKey, %Key);