Linq query with group by retrieving percentage <p>I have to calculate the percentage in the group by clause. More in depth I need to calculate the percentage of ControlForms that have Status = 'False'. The Status is in the table checkResult.</p> <pre><code>var items = (from controlForm in dataContext.ControlForms join controlFormStatus in dataContext.ControlFormStatus on controlForm.FK_ControlFormStatus equals controlFormStatus.Id join docCheck in dataContext.DocumentChecks on controlForm.Id equals docCheck.FK_ControlForm join checkResult in dataContext.CheckResults on docCheck.FK_CheckResult equals checkResult.Id where controlForm.FK_ControlCycle.ToString().Equals(controlCycleId) &amp; ( controlFormStatus.Description.Equals(Constants.ControlFormStatusTestControlOwner) | controlFormStatus.Description.Equals(Constants.ControlFormStatusApprovalProcessOwner)) group controlForm by new { controlForm.Id, controlForm.FK_ControlCycle, controlForm.FK_SampleNode, controlForm.FK_Control, /*FUNCTION*/} into ctrlForm select new ControlFormReportPartialResults(ctrlForm.Key.Id, ctrlForm.Key.FK_ControlCycle, ctrlForm.Key.FK_SampleNode, ctrlForm.Key.FK_Control, ValueFunction)); </code></pre> <p>Can anyone suggest me what I have to but istead of /<em>FUNCTION</em>/? Or if there is another way to solve the problem? Any help is really welcome!</p> <p>Thanks in advance, Dario Zanelli</p>