title: SQL Date intelligence: filtering data by seconds ran from last known valid result
body: <p>Help! We're trying to create a new column (Is Valid?) to reproduce the logic below.</p>
  
  <p>It is a binary result that:</p>
  
  <ul>
  <li><p>it is 1 if it is the first known value of an ID</p></li>
  <li><p>it is 1 if it is 3 seconds or later than the previous "1" of that ID</p></li>
  </ul>
  
  <p><strong>Note 1</strong>: this is not the difference in seconds from the previous record</p>
  
  <ul>
  <li>It is 0 if it is less than 3 seconds than the previous "1" of that ID</li>
  </ul>
  
  <p><strong>Note 2</strong>: there are many IDs in the data set</p>
  
  <p><strong>Note 3</strong>: original dataset has ID and Date</p>
  
  <p>Attached a PoC of the data and the expected result.</p>
  
  <p><img src="https://i.stack.imgur.com/k4KUQ.png" alt="PoC dataset image"></p>
  
  <p><img src="https://drive.google.com/file/d/1rPNEai1CAtklzjxfN5UDy6-WydsoS0rt/view?usp=sharing" alt="PoC dataset spreadsheet"></p>