Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jerryyang756
Creator
Creator

Finding compliance and non-compliance between two data sets

Hi all,

I have following two data sets. I need to show compliant and non compliant data sets after comparing them.

Table-1.

Table-1Table-1

 

 

 

 

 

 

 

Table-2.

Table-2Table-2

 

 

 

 

 

 

 

  • The compliant set should show following table from table 1 after comparing with table 2 .

CompliantCompliant

 

 

 

 

  • The Non-Compliant's are the mismatched data from Table -1 

Non-CompliantNon-Compliant

 

 

 

 

 

 

  • The remaining set from Table -2  need to show as - Mismatched Data 

MismatchedMismatched

 

 

 

 

Please find the attached file 

Labels (2)
1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

MC.PNG

Script:

Raw:
LOAD
"Server IP"&'|'&"Server Name" &'|'& Department as Key,
"Server IP",
"Server Name",
Department,
HasError,
DeviceType
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-1$]);    //replace filepath with yours 

Mapping:
LOAD
"Server IP",
"Server Name",
Department,
"Server IP"&'|'&"Server Name" &'|'& Department as KeyExist
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-2$]);     //replace filepath with yours 


NoConcatenate
Compliant:
load *,'Compliant' as Status resident Raw
where exists(KeyExist,Key);


NonCompliant:
load *,'Non-Compliant' as Status resident Raw
where not exists(KeyExist,Key);

Concatenate
MisMatched:
load *,'MisMatched' as Status resident Mapping
where not exists(Key,KeyExist);


drop table Raw;
drop table Mapping;


exit Script;

 

View solution in original post

3 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

MC.PNG

Script:

Raw:
LOAD
"Server IP"&'|'&"Server Name" &'|'& Department as Key,
"Server IP",
"Server Name",
Department,
HasError,
DeviceType
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-1$]);    //replace filepath with yours 

Mapping:
LOAD
"Server IP",
"Server Name",
Department,
"Server IP"&'|'&"Server Name" &'|'& Department as KeyExist
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-2$]);     //replace filepath with yours 


NoConcatenate
Compliant:
load *,'Compliant' as Status resident Raw
where exists(KeyExist,Key);


NonCompliant:
load *,'Non-Compliant' as Status resident Raw
where not exists(KeyExist,Key);

Concatenate
MisMatched:
load *,'MisMatched' as Status resident Mapping
where not exists(Key,KeyExist);


drop table Raw;
drop table Mapping;


exit Script;

 
Brett_Bleess
Former Employee
Former Employee

Did Arthur's solution work for your use case?  If so, do not forget to return to the post and use the Accept as Solution button on Arthur's post to give him credit for the assistance with things and to let other Community Members know this worked for you.  If you are still working on things, leave an update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
jerryyang756
Creator
Creator
Author

@Arthur_Fong  Many thanks , It is working .