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: 
Not applicable

How to show data that not existing in another table

Dear guys,

Assuming I have 2 tables

table 1:

itemDescription
001Product 1
002Product 2
003Product 3
004Product 4

table 2:

itemDescription
001Product 1
002Product 2
005Product 5
006Product 6

Question is "how to recognize/show the item 005 & 006 as they don't exist in table1?"

Many thanks,

Dong

1 Solution

Accepted Solutions
sunny_talwar

Add Flags when you load them

Table:

LOAD item,

    Description,

    'Table1' as Flag

FROM

[https://community.qlik.com/thread/236561]

(html, codepage is 1252, embedded labels, table is @1);

Concatenate (Table)

LOAD item,

    Description,

    'Table2' as Flag

FROM

[https://community.qlik.com/thread/236561]

(html, codepage is 1252, embedded labels, table is @2)

Where not Exists(item);

Capture.PNG

View solution in original post

10 Replies
Not applicable
Author

Any one can help, please?

sunny_talwar

Add Flags when you load them

Table:

LOAD item,

    Description,

    'Table1' as Flag

FROM

[https://community.qlik.com/thread/236561]

(html, codepage is 1252, embedded labels, table is @1);

Concatenate (Table)

LOAD item,

    Description,

    'Table2' as Flag

FROM

[https://community.qlik.com/thread/236561]

(html, codepage is 1252, embedded labels, table is @2)

Where not Exists(item);

Capture.PNG

Not applicable
Author

Hi Sunny,

Could you please check whether syntax error in my scripts? I don't know why error occurs

CheckCode:

LOAD

     [Distributor Code] as Code,

     'Existed' as Flag

FROM

[.\Master data for stock report.xlsx]

(ooxml, embedded labels, table is [SA-Distributors Mapping]);

Concatenate(CheckCode)

LOAD

     right(Item,6) as Code,

     'SA new' as Flag

FROM

[.\Daily Stocks\Daily Sanofi Stock.xlsx]

(ooxml, embedded labels, table is [Sheet1])

Where not exists(Code);

Error message:

Field not found - <Code>

Concatenate(CheckCode)

LOAD

     right(Item,6) as Code,

     'SA new' as Flag

FROM

[.\Daily Stocks\Daily Sanofi Stock.xlsx]

(ooxml, embedded labels, table is [Sheet1])

Where not exists(Code)

Many thanks

Anonymous
Not applicable
Author

Hi Dong,

apply following script

CheckCode:

LOAD

     [Distributor Code] as Code,

     'Existed' as Flag

FROM

[.\Master data for stock report.xlsx]

(ooxml, embedded labels, table is [Master]);

Concatenate(CheckCode)

LOAD

     right(Item,6) as Code,

     'SA new' as Flag

FROM

[.\Stock.xlsx]

(ooxml, embedded labels, table is [Sheet1])

Where not exists(right(Item,6));

Thanks,

tresesco
MVP
MVP

Try:   Where not exists(Code, right(Item,6) );

Not applicable
Author

Hi,

The error is in below snippet (bold):

Concatenate(CheckCode)

LOAD

    right(Item,6) as Code,

    'SA new' as Flag

FROM

[.\Daily Stocks\Daily Sanofi Stock.xlsx]

(ooxml, embedded labels, table is [Sheet1])

Where not exists(Code);

Try this:

Concatenate(CheckCode)

LOAD

    right(Item,6) as Code,

    'SA new' as Flag

FROM

[.\Daily Stocks\Daily Sanofi Stock.xlsx]

(ooxml, embedded labels, table is [Sheet1])

Where not exists(Code,right(Item,6));

hope this helps.

Not applicable
Author

Many thanks Tresesco. I have solved my error.

However, I have to mark Sunny's answer is the correct one. Is it ok for you?

sunny_talwar

You can always reward multiple responses by marking helpful responses.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny

tresesco
MVP
MVP

It's good to be rewarded, but that's not the ultimate reason we are here for. I am happy that I could help.