title: Date aggregation on Presto
body: <p>I have a table that has the list of products sold each day and would like to know what date is when we had the 95th percentile of sale (for a given product). I am not looking at averages as there are days when the sales are high (and can skew the numbers)</p>
  
  <p>Here is the query am trying to run on presto</p>
  
  <pre><code>select approx_percentile(count(date), .95) 
  from logs 
  where vendor='abc' 
    and product='biscuit' 
    and date &gt;= date_parse(date_format(now() - interval '30' day, '%Y-%m-%d'), '%Y-%m-%d');
  </code></pre>
  
  <p>But presto does not seem to like it and throws the below error message</p>
  
  <blockquote>
    <p>Query  failed: Unexpected parameters (date, double) for function approx_percentile. Expected: approx_percentile(bigint, double) , approx_percentile(bigint, bigint, double) , approx_percentile(double, double) , approx_percentile(double, bigint, double) </p>
  </blockquote>
  
  <p>PS : date is of the Type 'date'</p>