title: Generate row index for table based on last updated date
body: <p>I would like to generate an index  row in a table that may contain duplicates. the index need to be based on values from the table and last update date.</p>
  
  <p>The data looks like this:</p>
  
  <pre><code>ID    Val1  LastUpdateDate 
  --   ------  -------------
  1      0     07.09.2019
  1      2.5   12.09.2019
  1      2.5   27.09.2019
  1      3.5   01.10.2019
  1      2.5   24.10.2019
  1      0     01.11.2019
  </code></pre>
  
  <p>I would like to have:</p>
  
  <pre><code>  ID    Val1  LastUpdateDate    index
      --   ------  -------------   ----
      1      0     07.09.2019      1
      1      2.5   12.09.2019      2
      1      2.5   27.09.2019      2
      1      3.5   01.10.2019      3
      1      2.5   24.10.2019      4
      1      0     01.11.2019      5
  </code></pre>
  
  
  
  <p>I've tried with the following code but it's not working:</p>
  
  <pre><code>  SELECT ID
           ,Value1
           ,Value2
           ,Value3
           ,LastUpdateDate
           ,(ROW_NUMBER() OVER (PARTITION BY ID ORDER BY last_update_date) - ROW_NUMBER()OVER(PARTITION BY  ID,Value1,Value2,Value3 ORDER BY ID,Value1,Value2,Value3)) AS index
  FROM Table1
  ORDER BY LastUpdateDate
  </code></pre>