Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts
I have table like below and need to create a accumulated field as mentioned in the expected sum column.
How to achieve this effectively in the load script itself?
Date | Amount | Period | Expected Result |
43374 | 10 | 1 | 10 |
43405 | 20 | 2 | 30 |
43435 | 30 | 3 | 60 |
43466 | 40 | 4 | 100 |
43497 | 50 | 5 | 150 |
43525 | 60 | 6 | 210 |
43556 | 70 | 7 | 280 |
43586 | 80 | 8 | 360 |
43617 | 90 | 9 | 450 |
43647 | 100 | 10 | 550 |
43678 | 110 | 11 | 660 |
43709 | 120 | 12 | 780 |
Many Thanks in advance
rangesum(above(sum(Amount),0,rowno()))
did you try what i suggested . The expression will sum rows cumulatively. If you have more rows you may have to tweak it a bit to get the right expression.
-Pradosh
load *,rangesum(peek([Expected Result]),[Amount]) as [Expected Result] inline [ Date , Amount,Period 43374, 10, 1 43405, 20, 2 43435, 30, 3 43466, 40, 4 43497, 50, 5 43525, 60, 6 43556, 70, 7 43586, 80, 8 43617, 90, 9 43647, 100, 10 43678, 110 ,11 43709, 120 ,12 ];
Thanks Pradosh,
My source data looks something like the attached i need to accumulate based on Key and %Calkey.
Hi Albert,
I will have to calculate the number is load script for lot of reasons.
I have attached the sample data below. Please check if we can calculate this outta load script.
Thanks
Varun
Hi,
You can use this script,
Load Date, Amount, Period, Amount + Previous(Amount) as [Expected Result] From ...