Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Eliminate records based on condition

$
0
0

Hi, Below is my data

 

Clr doc_#Clearing_DateInvoice_Amount
8521288920-Oct-14-205.34
8521288920-Oct-14-205.34
4820329295-Nov-14319.81
4820329295-Nov-14-319.81
8351811143-Nov-14331.65
25749518-Dec-14-10475.70
25749518-Dec-1410475.70
25749518-Dec-1410475.70
34389809819-Dec-142000.00
34389809819-Dec-14-1000.00
34389809819-Dec-14-1000.00
34389809819-Dec-14500.00
23709-Dec-1411132.00
23709-Dec-1420.00
33088-Oct-142000.00
33088-Oct-14-1000.00
33088-Oct-14-1000.00
12348-Oct-14-2000.00
12348-Oct-141000.00
12348-Oct-141000.00

 

Expected Output:

Clr doc_#Clearing_DateInvoice_AmountManual flag
8521288920-Oct-14-205.34I
8521288920-Oct-14-205.34I
8351811143-Nov-14331.65I
25749518-Dec-1410475.70I
34389809819-Dec-14500.00I
23709-Dec-1411132.00I
23709-Dec-1420.00I

 

Logic is groupby doc_num and date: eliminate those records where sum of amount of n rows for each doc# is zero

 

for Example: for doc_num 257495: we have 3 records but if we sum up invoice amount (-10475.70)+(10475.70)+(10475.70) = 10475.70, so instead of 3 records, I should get only one record that has data like below and create a column as Manual flag that has I=Include, E= Exclude

257495         18-Dec-14    10475.70     I


Viewing all articles
Browse latest Browse all 4999

Trending Articles