title: Query distinct in google bigquery
body: <p>I have a table with four columns, looking like this:</p>
  
  <pre><code>id,name, key, date
   1,'A' ,'x1','2015-11-11'
   2,'A' ,'x1','2015-11-11'
   3,'B' ,'x2','2015-11-11'
   4,'B' ,'x2','2015-11-11'
   5,'A' ,'x1','2015-11-12'
   6,'A' ,'x1','2015-11-12'
   7,'B' ,'x2','2015-11-12'
   8,'B' ,'x2','2015-11-12'
   9,'D' ,'x3','2015-11-12'
   10,'A' ,'x1','2015-12-11'
   11,'A' ,'x1','2015-12-11'
   12,'B' ,'x2','2015-12-11'
   13,'B' ,'x2','2015-12-11'
   14,'A' ,'x1','2015-12-12'
   15,'A' ,'x1','2015-12-12'
   16,'B' ,'x2','2015-12-12'
   17,'B' ,'x2','2015-12-12'
   18,'D' ,'x3','2015-12-12'
  </code></pre>
  
  <p>I want to count the number of distinct <em>new</em> <code>key</code>-s for each <code>date</code>:</p>
  
  <pre><code>2015-11-11  2                     -- (two distinct keys: x1 and x2)
  2015-11-12  1                     -- (one new key: x3)
  2015-12-11  2                     -- (two distinct keys: x1 and x2) - (different month 11)
  2015-12-12  1                     -- (one new key: x3) - (different month 11)
  </code></pre>
  
  <p><strong>Only distinct in each month.</strong></p>
  
  <p>How can I do this?</p>