Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I have a question for you:
How to achieve cumulative summation in a script,?
as shown in the screenshot below, how to write a script to get TABLE2 from TABLE1?
TABEL1 | TABLE2 | |||||||||
ROW1 | ROW2 | VALUE | ROW1 | ROW2 | VALUE | VALUE_TOTAL | ||||
A | 2018/6/15 | 1 | A | 2018/6/1 | 1 | 1 | ||||
A | 2018/6/1 | 1 | A | 2018/6/15 | 1 | 2 | ||||
B | 2018/6/10 | 1 | A | 2018/6/30 | 1 | 3 | ||||
A | 2018/6/30 | 1 | B | 2018/6/10 | 1 | 1 |
May be this?
Table2:
LOAD ROW1,
ROW2,
VALUE,
If(ROW1=Previous(ROW1), RangeSum(Peek('VALUE_TOTAL'), VALUE), VALUE) as VALUE_TOTAL Resident Table1 Order By ROW1, ROW2;
I need to change table1 into table2. How do I write the script?
TABLE1:
ROW1 | ROW2 | VALUE |
A | 2018/6/15 | 1 |
A | 2018/6/1 | 1 |
B | 2018/6/10 | 1 |
A | 2018/6/30 | 1 |
TABLE2:
ROW1 | ROW2 | VALUE | cumulative sum |
A | 2018/6/1 | 1 | 1 |
A | 2018/6/15 | 1 | 2 |
A | 2018/6/30 | 1 | 3 |
B | 2018/6/10 | 1 | 1 |
From table1 to table2, I need to have a column that's the cumulative sum.
Please refer to "cumulative sum" in table2.
To get table2 based on table1, how do I write the script?
May be this?
Table2:
LOAD ROW1,
ROW2,
VALUE,
If(ROW1=Previous(ROW1), RangeSum(Peek('VALUE_TOTAL'), VALUE), VALUE) as VALUE_TOTAL Resident Table1 Order By ROW1, ROW2;
ok, problem solved.
thank you very much