title: Kusto/KQL group count and then group by
body: <p>I'm quite new to kql/kusto and using in azure graph explorer. I have the following query:</p>
  <pre><code>resources 
  | join kind=leftouter (ResourceContainers 
  | where type=='microsoft.resources/subscriptions' 
  | project SubscriptionName=name, subscriptionId) on subscriptionId 
  | where type =='microsoft.containerservice/managedclusters' 
  | extend properties.agentPoolProfiles
  | project id, SubscriptionName,location, name,pool = (properties.agentPoolProfiles)  
  | mv-expand pool 
  | project id, SubscriptionName,cluster = name, size = pool.vmSize, nodes = pool.['count']
  </code></pre>
  <p>This now returns data like:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>cluster</th>
  <th>nodes</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>2</td>
  </tr>
  <tr>
  <td>B</td>
  <td>2</td>
  </tr>
  <tr>
  <td>A</td>
  <td>2</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I simplified the table as there would be the <strong>id</strong>, <strong>subscriptionname</strong>, <strong>size</strong> information as well but I removed to them to make it easier to see the problem.</p>
  <p>How could I group by the cluster and count the nodes per cluster and generate a result like</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>cluster</th>
  <th>nodes</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>4</td>
  </tr>
  <tr>
  <td>B</td>
  <td>2</td>
  </tr>
  </tbody>
  </table>
  </div>