- Posts: 24
- Thank you received: 0
Calculation based on previous row
12 years 6 months ago #1969
by Scott
Calculation based on previous row was created by Scott
Hello
I am trying to calculate the stock (new column) based on previous row
if the Article=prevArticle AND Store=prevStore .
Date,Article,Store,Movement,Qty
12-01-2011,Banana001,aaa,In,21
13-01-2011,Banana001,aaa,in,82
13-01-2011,Banana001,aaa,out,180
13-01-2011,Banana001,bbb,in,121
14-01-2011,Banana001,bbb,out,51
My dream result text file is:
Date,Article,Store,TypeMovement,Qty,Stock
12-01-2011,Banana001,aaa,In,21,21
13-01-2011,Banana001,aaa,In,8,29
13-01-2011,Banana001,aaa,out,18,11
13-01-2011,Banana001,bbb,in,12,23
14-01-2011,Banana001,bbb,out,5,18
Any Help is welcome
John Scott
I am trying to calculate the stock (new column) based on previous row
if the Article=prevArticle AND Store=prevStore .
Date,Article,Store,Movement,Qty
12-01-2011,Banana001,aaa,In,21
13-01-2011,Banana001,aaa,in,82
13-01-2011,Banana001,aaa,out,180
13-01-2011,Banana001,bbb,in,121
14-01-2011,Banana001,bbb,out,51
My dream result text file is:
Date,Article,Store,TypeMovement,Qty,Stock
12-01-2011,Banana001,aaa,In,21,21
13-01-2011,Banana001,aaa,In,8,29
13-01-2011,Banana001,aaa,out,18,11
13-01-2011,Banana001,bbb,in,12,23
14-01-2011,Banana001,bbb,out,5,18
Any Help is welcome
John Scott
Please Log in or Create an account to join the conversation.
12 years 6 months ago #1970
by admin
Mike
ETL Architect
Replied by admin on topic Re: Calculation based on previous row
Hello
This can be done by using 'running total' function
I have created a working example for you
extract all files into c:\support directory
Peter
This can be done by using 'running total' function
I have created a working example for you
extract all files into c:\support directory
Peter
Mike
ETL Architect
Please Log in or Create an account to join the conversation.