Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthick30
Creator
Creator

Comparing 2 Datasets and find 3 different values

I have 2 Data set. this month file and previous month file. Both files has same column names. Server name is the Primary Key for both the excels.

Now I need to compare this month file with previous month file and find out

1)how many servers newly present in this month file(not exist in previous month file) and mark is as new server count

2)how many servers unchanged between previous month file and this month file and mark it as unchanged server count

3)how many servers exist in previous month file and not exist in this month file and mark it as Remediated server count.

Any logic to achieve this

Labels (2)
1 Reply
maxgro
MVP
MVP

// test data

ThisMonth:
LOAD * inline [
Server
1
2
3
4
5
];

PrevMonth:
NOCONCATENATE LOAD * inline [
Server
4
5
6
7
];

Compare:
LOAD *, 1 as ThisMonth RESIDENT ThisMonth;
JOIN (Compare) LOAD *, 1 as PrevMonth RESIDENT PrevMonth;

LEFT JOIN (Compare) LOAD
Server,
IF(ThisMonth AND PrevMonth, 'Unchanged',
IF(ThisMonth, 'New',
'Remediated')) AS Status
RESIDENT Compare;

 

maxgro_0-1658434271141.png