title: Linq distinct count
body: <p>I have some data returned as the follow:  </p>
  
  <pre><code>Model { Guid Id }
  </code></pre>
  
  <p>and I have an int of the total items, <code>int totalCount</code>.</p>
  
  <p>I am trying to get the distinct count from the data that were returned as Category 1,
  and have the total item minus the count from Category 1 to be Category 2. </p>
  
  <p>I have the following linq to get the distinct count for Category 1, but how do I add the count for Category 2 into the IEnumerable?</p>
  
  <pre><code>var result = data.
      GroupBy(x =&gt; x.Id).
      Select(x =&gt; new { Category = "1", Value = x.Select(v =&gt; v.Id).Distinct().Count() }).
      GroupBy(x =&gt; x.Category).
      Select(x =&gt; new Item { Category = x.Key, Value = x.Sum(y =&gt; y.Value) });
  </code></pre>
  
  <p>and the Item Class have 2 members: string for Category and decimal for Value.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>Edit:
  So I have the follow data <code>IEnumerable&lt;Model&gt; data</code>, and it contains the following data:  </p>
  
  <pre><code>{ Id: 1 }
  { Id: 2 }
  { Id: 2 }
  { Id: 1 }
  { Id: 3 }
  { Id: 4 }
  </code></pre>
  
  <p>and totalCount = 10.</p>
  
  <p>I would like to get the distinct count of Id from data, which is 4 in this case, as category 1, and totalCount - distinct item to be category 2. So for the result I will have a <code>IEnumerable</code> of <code>Item</code> to have the following:</p>
  
  <pre><code>{ Category: "1", Value: 4 }, { Category: "2", Value: 6 }
  </code></pre>
  
  <p>For now my linq statement only return <code>{ Category: "1", Value: 4 }</code>, and I have no idea what to do next.</p>