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

Please help! How can i compare two tables and get the details that are not the same?

How can i produce the result table that are not the same with  Master Data Table and Daily Data Table?

Capture1.PNG

I created a table with the key as StudentName

i have this code but i get a null value

if(Books <> BooksNow, Books, 'none')

1 Solution

Accepted Solutions
d_prashanthredd
Creator III
Creator III

Hi Cherry,

MasterData:

Load StudentName, Books, Page from .....MasterData;

Lefdt Join(MasterData)

//We should join on Student Name and Book and that join should be left join as that is the Master Table

Daily:

Load StudentName, BooksNow as Books, Hours from ... DailyData;

Results:

Load resident StudentName, Books, Page MasterData where Books<>BooksNow;

If you really want to have matched records as well, then use if statement.

Load StudentName, Books, Page, if(len(StudentName)>0 and len(Books)>0, 'Match', 'No Match') as MatchStatus resident MasterDate;

drop table MasterDate;

View solution in original post

9 Replies
mdmukramali
Specialist III
Specialist III

Hi,

are you looking for the solution in the script level or in the front end ?

sasiparupudi1
Master III
Master III

Pl add your app here

olivierrobin
Specialist III
Specialist III

hello

i would join the two tables on common keys (student and book) by renaming these 2 fiels so they have the same name

and in a 2nd pass, create a field depending on the value (or the null value) of the field you want to compare.

something like that :

table:

load * from masterdata

joint(table)

load studentname,

bokksnow as books,

hours

from dailydata

result:

load *,

if(isnull(hours),1,0) as diff

.....

and then use that field in the charts

jubarrosor
Partner Ambassador
Partner Ambassador

Hi:

Try with not exists:

Help with 'where not exists'

Best Regards,

Juan P. Barroso

Anonymous
Not applicable
Author

Hi Mihammed,

Yes I am looking for a solution in the script level.

vishalarote
Partner - Creator II
Partner - Creator II

Hello Cherry B

Try this it works

MasterData:

load * inline [

StudentName,Books,Page

Samantha,01English,15

Samantha,02English,98

Samantha,05Logic,55

Samantha,07Electronics,35

Ansha,01Calculus,67

Ansha,01Statistics,100

Solen,09Math,50

Solen,08Logic,126

Edna,03English,25

Edna,04CSharp,104

Edna,07Qlikview,210

];

join(MasterData)

DailyData:

load * inline [

StudentName,BooksNow,Hours

Samantha,01English,1015

Samantha,07Electronics,3052

Ansha,01Calculus,647

Solen,08Logic,1426

Edna,03English,2544

Edna,04CSharp,1004

];

Result:

load Distinct

StudentName,

Books,

BooksNow,

Page

Resident MasterData

where not Exists(BooksNow,Books);

drop Field BooksNow;

drop table MasterData;

load Distinct *

Resident Result;

PFA

d_prashanthredd
Creator III
Creator III

Hi Cherry,

MasterData:

Load StudentName, Books, Page from .....MasterData;

Lefdt Join(MasterData)

//We should join on Student Name and Book and that join should be left join as that is the Master Table

Daily:

Load StudentName, BooksNow as Books, Hours from ... DailyData;

Results:

Load resident StudentName, Books, Page MasterData where Books<>BooksNow;

If you really want to have matched records as well, then use if statement.

Load StudentName, Books, Page, if(len(StudentName)>0 and len(Books)>0, 'Match', 'No Match') as MatchStatus resident MasterDate;

drop table MasterDate;

bc-thebruuu
Creator
Creator

I would use the hash function on all the columns

and If need be use this new field as key

Anonymous
Not applicable
Author

Thank you so much for the help. I really appreciate it.