title: How to calculate the average monthly consumption sales in sql server 2008
body: <p>How to <strong>calculate</strong> the average monthly consumption sales in sql <strong>server 2008</strong></p>
  
  <pre><code>SELECT * FROM (SELECT year(OrderDate) as [year],left(datename(month,OrderDate),3)as [month],Qty as QTY FROM DailyDispatch where CustID=1 ) as s PIVOT ( SUM(QTY)FOR [month] IN (jan, feb, mar, apr,may, jun, jul, aug, sep, oct, nov, dec))as P
  </code></pre>
  
  <p>i am getting the result,but i want to do the sum of all months and dividing it to the current month.
  for eg the all sum of sales up-to this September is 1000,so i want to 1000/9 and display the result.</p>