Count on one custom dimension and group by another with BigQuery
<p>I'm totally new to BigQuery, please excuse me for any obvious mistake. I'm trying to build a query where I can count the number of distinct element from one custom dimension and group this by another custom dimension.</p>

<p>I tried this but It doesn't work :</p>

<pre><code>SELECT
  MAX(IF(hits.customDimensions.index=7,hits.customDimensions.value,NULL)) AS Author,
  COUNT(MAX(IF(hits.customDimensions.index=10,hits.customDimensions.value,NULL))) AS Articles
FROM (
  SELECT
    *
  FROM
    TABLE_DATE_RANGE([blablabla-blabla-115411:104672022.ga_sessions_test], TIMESTAMP('20160927'), TIMESTAMP('20161024'))) AS t0
GROUP BY
MAX(IF(hits.customDimensions.index=7,hits.customDimensions.value,NULL)) AS Author,
</code></pre>