Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need RangeSum for Category. How to build this function in my script for this table?
Final table should be
A,1,10;
A,3, 25;
D,2,5;
D,3,10
Test:
LOAD * INLINE [
Category, K, Value
A, 1, 10
A, 3, 15
D, 2, 5
D, 3, 5
];
Tmp_Test:
NoConcatenate
Load
Category,
K,
RangeSum(Value) as Cum
Resident Test;
Try with inter-record functions like Peek() / Previous() :
Tmp_Test:
NoConcatenate
Load
Category,
K,
If(Peek(Category)= Category,RangeSum(Value, Peek(Cum)),Value) as Cum
Resident Test
ORDER BY Category, K; // may need an appropriate sort of the input table if your input table is not sorted as needed.