Forum Discussion

Raj's avatar
Raj
New Contributor II
8 years ago

How to get Running Totals

Hello.

I want to get running totals: here is my raw dataset:

key1 key2 qtr ct

  1.  2.      1.  5
    
  2.  3.       2. 4
    
  3.  4.      3.  1
    
  4.  5.      4.   3
    

My result:

key1 key2 qtr RunningTotal

  1.  2.      1.  5
    
  2.  3.      2.  9
    
  3.  4.      3.  10
    
  4.  5.      4.  13
    

Thanks.

3 Replies

    • tstack's avatar
      tstack
      Former Employee

      Not sure if there is a Snap that does this type of thing directly, you might need to use the Script snap.

      Alternatively, you can use the GroupByN snap to collect all of the documents into a single big document, use the expression language to operate on that, and then split the docs out again.

      Pipeline parameters cannot be changed during the execution of a pipeline.

    • aleung's avatar
      aleung
      Contributor III

      I don’t think that will work since you can’t update a pipeline parameter. This is a tough one, you might end up doing this either on the source or target system.