title: traverse to previous rows from current row in a table
body: <p>I need to traverse to previous 10 rows from current row and check if all rows has codealert_hour . If all rows has alerts then display  prev row alert else display null.</p>
  
  <p>image shows sample data. </p>
  
  <p>current row is id=1176.</p>
  
  <p>Now it has to traverse from id 1175 to 1166 and check all alerts. Here all alerts are present (i.e no null alerts) so it should fetch prev row alert (i.e id 1175 alert= 5)  in a column of current row.</p>
  
  <p>I tried using lag function but its not working.
  please help.</p>
  
  <p><img src="https://i.stack.imgur.com/hTSSY.png" alt="enter image description here"></p>