Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bsbernabe
Creator
Creator

Duplicate data but diff. date base on day

Hello There,

My concern is similar in my previews i post but diff. case base on of the day of  date see below  the scenario:

if the customer and serial is same and the date of the Month and Year is same but different Day  how to get the last Agreement ID.

This is a sample data below:

AgreementIDCustomer NameSerial No.Trans_Date
135844ROMEO TORRE2DY101480403/06/2015
136622ROMEO TORRE2DY101480403/07/2015
139602RIO CURAN KPY00E07700404/11/2015
214039RIO CURAN KPY00E07700406/25/2016

 

Then this is should be:

AgreementIDCustomer NameSerial No.Trans_Date
136622ROMEO TORRE2DY101480403/07/2015
139602RIO CURAN KPY00E07700404/11/2015
214039RIO CURAN KPY00E07700406/25/2016

 

Best Regards,

Bing

Labels (1)
13 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Sorry I didnt have QV right now.

Maybe try this:

Try this:

Directory;

Sheet1:
LOAD AgreementID,
[Customer Name],
[Serial No.],
Trans_Date
FROM
[..\..\..\Desktop\Data_.xls]
(biff, embedded labels, table is Sheet1$);

noconcatenate

  • Raw:
    load *,[Customer Name]&[Serial No.] as Key,
    [Customer Name]&[Serial No.]&num(Trans_Date) as Key2;
    load *,num#(Year&num(Month,'00')) as YearPeriod;
    load *,Year(Trans_Date) as Year,Month(Trans_Date)as Month;

LOAD * RESIDENT Sheet1;

drop table Sheet1;

 

  • Data:
    NoConcatenate
    load *,Key&num(Trans_DateMax)as Key2;

load Key,date(max(Trans_Date),'MM/DD/YYYY') as Trans_DateMax
Resident Raw
group by Key,YearPeriod;

drop field Key;

bsbernabe
Creator
Creator
Author

Thank you So much...

bsbernabe
Creator
Creator
Author

The solution was so great but i have another concern cause there is a problem the trans_date that suppose to be get the last AgreementID like 

Below is the output right now:  

 

sample.png

below is my wish to display if also the Trans date is same get the last AgreementID

 

sample1.png

Best Regard,

Bing

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Same concept applied:

Dimension used is AgreementIDMax.

MC.PNG

Script:

Directory;

Sheet1:
LOAD
AgreementID,
"Customer Name",
"Serial No.",
Trans_Date
FROM [lib://AttachedFiles/Data_.xls]
(biff, embedded labels, table is Sheet1$);

noconcatenate

Raw:
load *,[Customer Name]&[Serial No.] as Key,
[Customer Name]&[Serial No.]&num(Trans_Date)&AgreementID as Key2;
load *,num#(Year&num(Month,'00')) as YearPeriod;
load *,Year(Trans_Date) as Year,Month(Trans_Date)as Month;
LOAD * RESIDENT Sheet1;

drop table Sheet1;

 

Data:
NoConcatenate
load *,Key&num(Trans_DateMax)&AgreementIDMax as Key2;
load Key,date(max(Trans_Date),'MM/DD/YYYY') as Trans_DateMax,
max(AgreementID) as AgreementIDMax
Resident Raw
group by Key,YearPeriod;

drop field Key;