Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
wood
Contributor III
Contributor III

Implement a cumulative sum in the script

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
ROW1ROW2VALUE   ROW1ROW2VALUEVALUE_TOTAL
A2018/6/151
 
  A2018/6/111
A2018/6/11   A2018/6/1512
B2018/6/101   A2018/6/3013
A2018/6/301   B2018/6/1011
Labels (1)
3 Solutions

Accepted Solutions
Anil_Babu_Samineni

What you want to see in table2?
Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

Anil_Babu_Samineni

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;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

wood
Contributor III
Contributor III
Author

ok, problem solved.

thank you very much Smiley Very Happy

View solution in original post

6 Replies
Anil_Babu_Samineni

What you want to see in table2?
Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
wood
Contributor III
Contributor III
Author

I need to change table1 into table2. How do I write the script?

Anil_Babu_Samineni

Then, what is the title do? What cumulative you want to see? Can you explain the result how you want to see?
Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
wood
Contributor III
Contributor III
Author

TABLE1:

ROW1ROW2VALUE
A2018/6/151
A2018/6/11
B2018/6/101
A2018/6/301

 

TABLE2:

ROW1ROW2VALUEcumulative sum
A2018/6/111
A2018/6/1512
A2018/6/3013
B2018/6/1011

 

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?

 

 

 

 

 

Anil_Babu_Samineni

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;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
wood
Contributor III
Contributor III
Author

ok, problem solved.

thank you very much Smiley Very Happy