Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
drjoffily
Partner Ambassador Alumni
Partner Ambassador Alumni

How to get the difference between two datasets?

Hi all,

I have a daily CSV file and I'm trying to create a history file based on the records that are in "Yesterday's file" but not in "today's file". To do that I'm trying to get the difference between yesterday's file and today's file. Whatever is in yesterday's file but not in today's file I'll save in a separate QVD. Concatenate it with my results from before yesterday's results.

My yesterday's file is already in a QVD and my today's file is still in CSV format. So, what I'm trying to do is to load both, my QVD and my CSV into a QVW and manipulate it to get the difference between both.

Here is an ideas I got from the community but is not working for me yet.

Daily_Dump:

Load * From TradeDump.CSV

Yesterday_Daily_Dump:

Load * From TradeDump.qvd

MissingInDailyDump:

LOAD * Resident Yesterday_Daily_Dump
Where not Exists(MissingInDailyDump.[Transaction Number],Daily_Dump.[Transaction Number]);

store MissingInDailyDump into MissingInDailyDump.qvd(qvd);

Does anyone know how to make the script above work?

Or, does anyone have a better idea?

Cheers,

Marcos

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hei attach is an example
the script goes like this
Today:
LOAD Tran_number,
Amonunt
FROM

(
ooxml, embedded labels, table is Today);

Yesterday:
NoConcatenate LOAD Tran_number,
Amonunt
FROM

(
ooxml, embedded labels, table is Yesterday)
where not Exists(Tran_number);

drop table Today;

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hei attach is an example
the script goes like this
Today:
LOAD Tran_number,
Amonunt
FROM

(
ooxml, embedded labels, table is Today);

Yesterday:
NoConcatenate LOAD Tran_number,
Amonunt
FROM

(
ooxml, embedded labels, table is Yesterday)
where not Exists(Tran_number);

drop table Today;
drjoffily
Partner Ambassador Alumni
Partner Ambassador Alumni
Author

Nice one!

Thanks Liron.