Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am trying to get a an output using peek function , scenario is mentioned below :
Name | Date | Amount |
a | 10/10/2012 | 20 |
b | 11/11/2012 | 55 |
c | 12/12/2012 | 44 |
d | 10/13/2013 | 20 |
e | 10/14/2013 | 70 |
f | 10/15/2013 | 10 |
Now i want an extra column which should come like this :
Name | Date | Amount | Comm |
a | 10/10/2012 | 20 | 20 |
b | 11/11/2012 | 55 | 75 |
c | 12/12/2012 | 44 | 119 |
d | 10/13/2013 | 20 | 139 |
e | 10/14/2013 | 70 | 209 |
f | 10/15/2013 | 10 | 219 |
Regards
Jyothish KC
BI Consultant
If you have not yet got it right, please note one correction to my early post:
- single quotes around field name within peek function.
- and better put a check of rowno to avoid first row.
finally try:
Load
If( Rowno()<>1,Amount+Peek('NewAmount'), Amount) as NewAmount
from <>;
Otherwise, Kaushik Solanki 's solution would also work with single qoutes correction.
Try like:
Load
Amount+Peek(NewAmount) as NewAmount
from <>;
Hi,
Try below code in script.
DATA:
Load * inline [
Name, Date, Amount
a, 10/10/2012, 20
b, 11/11/2012, 55
c, 12/12/2012, 44
d, 10/13/2013, 20
e, 10/14/2013, 70
f, 10/15/2013, 10
];
DATA2:
Load *,RangeSum(Amount,Peek([CommSum])) as CommSum
Resident DATA;
Drop table DATA;
Regards,
Kaushik Solanki
if u want tis in straight table mean use accumulation it will be be down the expression tab and give the steps 100 so if u have 100 record
for eg
comm result will be like this
5 5
10 15
15 30
20 50
25 75
30 105
so on so on
If you have not yet got it right, please note one correction to my early post:
- single quotes around field name within peek function.
- and better put a check of rowno to avoid first row.
finally try:
Load
If( Rowno()<>1,Amount+Peek('NewAmount'), Amount) as NewAmount
from <>;
Otherwise, Kaushik Solanki 's solution would also work with single qoutes correction.
Thanx...