Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

pritamb89
Contributor

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.

Tab-1.PNGTable-1

 

 

 

 

 

 

 

Table-2.

Tab-2.PNGTable-2

 

 

 

 

 

 

 

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

Compliant.PNGCompliant

 

 

 

 

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

Non Compliant.PNGNon-Compliant

 

 

 

 

 

 

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

Mismatched.PNGMismatched

 

 

 

 

Please find the attached file 

2 Replies
Partner
Partner

Re: Finding compliance and non-compliance between two data sets

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;

 
Support
Support

Re: Finding compliance and non-compliance between two data sets

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 don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.