4 Replies Latest reply: Jul 28, 2016 5:45 AM by Jonathan Dienst RSS

    Getting previous value if the value is blank

    Dean McCook

      Hi All,

       

      I have data like below:

       

      CustomerDateCredit Limit
      140140Dec 201510,000
      140140Jan 201612,000
      140140Feb 2016-
      140140Mar 201615,000
      140140Apr 2016-
      299211Dec 2015-
      299211Jan 2016130,000
      299211Feb 2016-
      299211Mar 2016-
      299211Apr 2016120,000
      181236Dec 2015-
      181236Jan 2016-
      181236Feb 2016-
      181236Mar 2016-
      181236Apr 201655,000

       

      What I want is for the months with no value, for them to look for a previous value for the customer and use that. e.g.

       

      CustomerDateCredit Limit
      140140Dec 201510,000
      140140Jan 201612,000
      140140Feb 201612,000
      140140Mar 201615,000
      140140Apr 201615,000
      299211Dec 2015-
      299211Jan 2016130,000
      299211Feb 2016130,000
      299211Mar 2016130,000
      299211Apr 2016120,000
      181236Dec 201555,000
      181236Jan 201655,000
      181236Feb 201655,000
      181236Mar 201655,000
      181236Apr 201655,000

      (note: Customer 299211 for Dec 2015 has no previous value, so is blank)

      I was thinking I could possibly add a rowno() and  use peek(), but any advice/help appreciated.

       

      Cheers,


      Dean