title: Count Number of occurrences of column values in DataTable - Tricky
body: <p>I need to count the number of occurrences of several different columns. For example my DataTable Columns are as below, they are just string and date types</p>
  
  <pre><code>[Case___], [Status],[Summary] ,[Description], 
  [assigned_group], [Assigned_Individual], [Alert_Status],
  [Date_Time_Created], [Date_Time_Resolved] ,
  [Date_Time_Closed] ,[Data_Output_Type]
  </code></pre>
  
  <p>For each ****Assigned_Individual** I need to count </p>
  
  <p>The number of times that this person had a <strong>Status of Resolved || Closed</strong>, </p>
  
  <p>The number of times this person had an <strong>Alert_Status = 'SLA Alert'  AND Status &lt;> 'Resolved' AND Status &lt;> 'Closed'</strong></p>
  
  <p>The Number of times this person had an <strong>Alert_Status = 'SLA Missed' AND Data_Output_Type = 'Active Tickets'</strong></p>
  
  <p>My goal is to return a DataTable or List with records such as below</p>
  
  <p><strong>Assigned_Indivual  -  Resolved  -  SLA Alert  -  SLA Missed</strong></p>
  
  <p>bob, 5, 1, 4
  Mary, 2,1,3
  Ashley, 7,0,3</p>
  
  <p>Im just looking for direction at this point as I Know I will likely need to use LINQ I cannot even comprehend a way to do this.</p>
  
  <p>Thank you in advance Stack Oracles!</p>
  
  <p>Im able to get the number of times an person has Status == "Resolved" || Status == "Closed" using the code below</p>
  
  <pre><code>var groupedData = from b in dt.AsEnumerable()
                            where b.Field&lt;string&gt;("Status") == "Resolved" || b.Field&lt;string&gt;("Status") == "Closed"
                            group b by new
                            {
                                Assigned_Individual = b.Field&lt;string&gt;("Assigned_Individual"),
                                Status = b.Field&lt;string&gt;("Status"),
                                assigned_group = b.Field&lt;string&gt;("assigned_group")
                            }
                                into g
  
                                let Counter = g.Count()
                                select new
                                {
                                    Assigned_Individual = g.Key.Assigned_Individual,
                                    Status = g.Key.Status,
                                    assigned_group = g.Key.assigned_group,
                                    Count = Counter
                                };
  </code></pre>
  
  <p>Which returns a count such as bob, 5 OR Mary, 2
  But I need to know how to do this without using a where condition so that I can count my 3 conditions listed above.</p>