title: Kusto/KQL: summarize by time bucket AND count(string) column
body: <p>I have a table of http responses including timestamp, service name and the http response code I want to query using KQL/Kusto.</p>
  <p>My goal is to have a table that tells me &quot;How many http responses of a certain type (2xx, 4xx etc) did a particular service have within the last 5 minutes over time&quot;</p>
  <p>I want to summarize the rows by a time bucket of 5min <strong>and</strong> the ResponseType (basically the response code class) as well - but I can't seem to make it work. When I add  <code>count(ResponseType)</code> to the summarize clause, it returns the error message <code>Function 'count' cannot be invoked in current context</code>.</p>
  <p>My KQL looks like this</p>
  <pre><code>InsightsMetrics 
  | extend Tags = parse_json(Tags)
  | extend Responsecode = tostring(Tags.[&quot;code&quot;]) 
  | extend ResponseType = strcat(substring(Responsecode, 0, 1), &quot;XX&quot;)
  | extend Service = tostring(Tags.[&quot;service&quot;]) 
  | where TimeGenerated &gt;= now(-4h)
  | where Namespace == &quot;prometheus&quot;
  | where Name contains &quot;traefik_service_requests_total&quot;
  | project TimeGenerated, Responsecode, Service, ResponseType
  | summarize by bin(TimeGenerated, 5m), ResponseType
  </code></pre>
  <p>which returns data like this:</p>
  <pre><code>| TimeGenerated       | ResponseType | Service                                                  |
  |---------------------|--------------|----------------------------------------------------------|
  | 2020-10-01 10:25:00 | 3XX          | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  | 2020-10-01 10:30:00 | 2XX          | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  | 2020-10-01 10:30:00 | 2XX          | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  | 2020-10-01 10:30:00 | 4XX          | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  </code></pre>
  <p>When I want something like this instead</p>
  <pre><code>| TimeGenerated       | ResponseType | count(ResponseType) | Service                                                  |
  |---------------------|--------------|---------------------|----------------------------------------------------------|
  | 2020-10-01 10:25:00 | 3XX          | 1                   | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  | 2020-10-01 10:30:00 | 2XX          | 2                   | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  | 2020-10-01 10:30:00 | 4XX          | 1                   | prod-service-internal-50f0bab542c7d81ed22e@kubernetescrd |
  </code></pre>