title: How to get group row_number() based on change in indicator column value?
body: <p>I have TransactionTime, Amount, and a ResetCountInd (0/1) column.</p>
  
  <p>Goal is to get a running total of Amount column, from one ResetCountInd=0 row until the next.</p>
  
  <p>I understand that if I had a PartitionNumber column, starting numbering where ResetCountInd=0, staying constant until the next, I could easily perform the running total with the window functions.</p>
  
  <p>I'm not understanding how to get this PartitionNumber column. Help?</p>
  
  <p>Visualization of what I'm after. White I have, yellow I don't - PartitionNumber in particular:</p>
  
  <p><a href="https://i.stack.imgur.com/MdQ2u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MdQ2u.png" alt="enter image description here"></a></p>
  
  <p>SQL generating sample data:</p>
  
  <pre><code>CREATE TABLE mytable(
     TransactionTime datetime NOT NULL PRIMARY KEY
    ,ResetCountInd   BIT  NOT NULL
    ,AddedAmount     INTEGER  NOT NULL
    ,PartitionNumber INTEGER  NOT NULL
    ,RunningTotal    INTEGER  NOT NULL
  );
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 7:04 AM',0,0,1,0);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 9:14 AM',1,50310,1,50310);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 12:00 PM',1,276229,1,326539);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 1:35 PM',1,45389,1,371928);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 1:52 PM',0,0,2,0);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 3:35 PM',1,108629,2,108629);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 5:04 PM',1,19984,2,128613);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 5:44 PM',1,69338,2,197951);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 6:17 PM',1,126595,2,324546);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/12/16 10:59 PM',1,33720,2,358266);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/13/16 8:57 AM',1,45230,2,403496);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/13/16 11:00 AM',0,0,3,0);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/13/16 11:03 AM',1,155323,3,155323);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/13/16 11:09 AM',0,0,4,0);
  INSERT INTO mytable(TransactionTime,ResetCountInd,AddedAmount,PartitionNumber,RunningTotal) VALUES ('1/13/16 12:59 PM',1,67333,4,67333);
  </code></pre>