4 Replies Latest reply: May 7, 2013 9:57 AM by 1007410 RSS

    Counting number of consecutive days and only use greater than X days

    1007410
      I have data that looks like this:

      ID Date: Value
      55 2-24-2013 120
      55 2-25-2013 126
      55 2-26-2013 120
      55 2-27-2013 130
      55 3-01-2013 110
      55 3-02-2013 126
      55 3-05-2013 130
      72 2-28-2013 120
      72 3-01-2013 126
      72 3-02-2013 120
      72 3-10-2013 130
      72 3-11-2013 110
      72 3-12-2013 126
      72 3-13-2013 130



      So I would like to detemine the data that has more then 2 consecutive days and then take the change in value to get data like this.

      ID Date: Value Delta
      55 2-24-2013 120 Null
      55 2-25-2013 126 6
      55 2-26-2013 120 -6
      55 2-27-2013 130 10
      72 2-28-2013 120 Null
      72 3-01-2013 126 6
      72 3-02-2013 120 -6
      72 3-10-2013 130 Null
      72 3-11-2013 110 -20
      72 3-12-2013 126 16
      72 3-13-2013 130 -4


      Any suggestions???? I am using SQL Developer for this.