title: SQL Server - Over partition with ROWS BETWEEN UNBOUNDED PRECEDING not working?
body: <p>According to the <a href="https://docs.microsoft.com/en-us/sql/t-sql/queries/select-over-clause-transact-sql?view=sql-server-2017" rel="nofollow noreferrer">documentation</a>:</p>
  <blockquote>
  <p>UNBOUNDED PRECEDING Applies to: SQL Server 2012 (11.x) through SQL
  Server 2017.</p>
  <p>Specifies that the window starts at the first row of the partition.
  UNBOUNDED PRECEDING can only be specified as window starting point.</p>
  </blockquote>
  <p>How come then, when using this:</p>
  <pre><code>   avg(Qty) over (partition by [Name] 
      ORDER BY [Period] desc ROWS BETWEEN UNBOUNDED PRECEDING AND 2 FOLLOWING)
  </code></pre>
  <p>I still get rolling averages.</p>
  <p>I understand that above construction should get me equivalent of <code>Select TOP(3) avg(qty)...</code>, at least according to the documentation.</p>
  <p>Am I missing something?</p>