Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to create a cumulative total within the script and I can't recall how to do it. Essentially I want to create a new field to show the rolling total for the year, see the below example. I can do it within a chart but require it to be added as a new field in the script.
Thanks in advance,
Ralph
Week | Qty | Rolling Qty |
---|---|---|
1 | 30 | 30 |
2 | 32 | 62 |
3 | 45 | 107 |
4 | 70 | 177 |
5 | 31 | 208 |
try:
Load *, if(rowno()=1,Qty,Peek(RollingQty)+Qty) AS RollingQty
Inline [
Week,Qty
1,30
2,32
3,45
4,70
5,31];
Check with this
Load *, (Alt(Previous(RollingQty),0)+Qty) AS RollingQty;
Load * Inline [
Week,Qty
1,30
2,32
3,45
4,70
5,31];
Hello,
I get a field not found error for RollingQty. For clarity in my example I want to create the Rolling Qty field, currently I only have week and Qty.
Thanks,
Ralph
try:
Load *, if(rowno()=1,Qty,Peek(RollingQty)+Qty) AS RollingQty
Inline [
Week,Qty
1,30
2,32
3,45
4,70
5,31];
That works brilliant.
Thanks,
Ralph
Hi,
Check with this
Load *, (Alt(Peek('RollingQty'),0)+Qty) AS RollingQty;
Load * Inline [
Week,Qty
1,30
2,32
3,45
4,70
5,31];