title: Grouping by last row where a value occurred & aggregating rows before that las occurrence
body: <p>I have a situation.</p>
  <p>I have a dataset where  different distinct 'IDs' have different actions in certain periods
  The thing is that an unique 'ID', can appear multiple time, but only sometime they perform a certain action.</p>
  <p>For example:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Day</th>
  <th>is_Action</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>x</td>
  <td>1</td>
  <td>0</td>
  </tr>
  <tr>
  <td>x</td>
  <td>2</td>
  <td>0</td>
  </tr>
  <tr>
  <td>x</td>
  <td>3</td>
  <td>1</td>
  </tr>
  <tr>
  <td>y</td>
  <td>2</td>
  <td>1</td>
  </tr>
  <tr>
  <td>y</td>
  <td>3</td>
  <td>2</td>
  </tr>
  <tr>
  <td>z</td>
  <td>1</td>
  <td>0</td>
  </tr>
  <tr>
  <td>z</td>
  <td>2</td>
  <td>1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>What I want to achieve is an aggregattion of the information that happened before the LAST is_Action that occured.</p>
  <p>For example, out of above table I want to achieve:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>days_passed_till_action</th>
  <th>actions_did_till_last_action</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>x</td>
  <td>2</td>
  <td>0</td>
  </tr>
  <tr>
  <td>y</td>
  <td>1</td>
  <td>1</td>
  </tr>
  <tr>
  <td>z</td>
  <td>1</td>
  <td>0</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Please let me know if would be possible to achieve something like that.
  Thank you!</p>