I need some help in completing the below task. The way I tried is not working.
Col1 Col2 Col3 Col4
ABC123 903534 0 10
ABC123 903534 0 12
ABC123 903534 1 14
ABC222 903534 1 30
ABC333 12345 0 5
ABC444 222333 0 5
Code: Select all
If the col3 = 0 then col4 = 0 and if previous.col1 = current.col1 and previous.col2 = current.col2 and If current.col3 = 1 then
sum( previous.Cols4) + Current.Col4 and store in the current column
I tried with StageVariable but somehow I am able to sum only the two rows . (Ex: svCol3)Expected Result:
ABC123 903534 0 0
ABC123 903534 0 0
ABC123 903534 1 36 (10+12+14)
ABC222 903534 1 30
ABC333 12345 0 0
ABC444 222333 0 0
Code: Select all
sv2: If sv1='Y' and svCol3 = 0 then sv2+ InLInk.Col4 else InLInk.Col4
sv1: If prev.col1 = curr.col1 and previous.col2 = current.column2 then 'Y' else 'N'
What is the order we have to follow on StageVariables? Is it from top to bottom or down to up?
thanks