Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have data like below, Can anyone suggest how I can achieve output below? basically it's sum of amount w.r.t. path and Id.
Please help on this.
Id | Path | Amount |
1 | 6 | 1000 |
1 | 12 | 1000 |
1 | 18 | 2000 |
1 | 24 | 1000 |
2 | 6 | 1000 |
2 | 12 | 2000 |
2 | 18 | 0 |
2 | 24 | 0 |
3 | 6 | 1000 |
3 | 12 | 3000 |
3 | 18 | 1000 |
3 | 24 | 0 |
Output-
Id | Path | Amount | SUM(Amount) |
1 | 6 | 1000 | 1000 |
1 | 12 | 1000 | 2000 |
1 | 18 | 2000 | 4000 |
1 | 24 | 1000 | 5000 |
2 | 6 | 1000 | 1000 |
2 | 12 | 2000 | 3000 |
2 | 18 | 0 | 3000 |
2 | 24 | 0 | 3000 |
3 | 6 | 1000 | 1000 |
3 | 12 | 3000 | 4000 |
3 | 18 | 1000 | 5000 |
3 | 24 | 0 | 5000 |
Hi,
You can do something like this in your script:
Table1:
LOAD if(Peek(Id)=Id,Amount+Peek(AmountAcumulated),Amount) as AmountAcumulated,
* INLINE [
Id, Path, Amount
1, 6, 1000
1, 12, 1000
1, 18, 2000
1, 24, 1000
2, 6, 1000
2, 12, 2000
2, 18, 0
2, 24, 0
3, 6, 1000
3, 12, 3000
3, 18, 1000
3, 24, 0
];
Hi,
try this:
=RangeSum(Above(Amount,0,rowno()))
Hi,
You can do something like this in your script:
Table1:
LOAD if(Peek(Id)=Id,Amount+Peek(AmountAcumulated),Amount) as AmountAcumulated,
* INLINE [
Id, Path, Amount
1, 6, 1000
1, 12, 1000
1, 18, 2000
1, 24, 1000
2, 6, 1000
2, 12, 2000
2, 18, 0
2, 24, 0
3, 6, 1000
3, 12, 3000
3, 18, 1000
3, 24, 0
];
Brilliant Jaume Criballés Faja ! Thanks a lot for quick solution.
Try this as your expression
=if(Id=Above(Id),RangeSum(Above(sum(Amount),0,RowNo(TOTAL))),sum(Amount))