title: Calculate average over a date range
body: <p>I'd like to find out how many people did any event (Count of records in EvntFct table).</p>
  
  <p>This provides me with the count for a day - April 1st. I'm using Teradata as my SQl server.</p>
  
  <p>But how would I calculate a daily average since then till yesterday?</p>
  
  <pre><code>SELECT CAST(EVENT_TIMESTAMP AS DATE) theDate,
                   COUNT(DISTINCT USER_ID) 
  FROM EventFct
  WHERE CAST(EVENT_TIMESTAMP AS DATE) &gt;'2014-05-10'
  GROUP BY theDate
  ORDER BY theDate
  </code></pre>