I have some data in a List of User defined types that contains the following data:
name, study, group, result, date. Now I want to obtain the name, study and group and then a calculation based onthe result and date. The calculation is effectively:
log(result).where max(date) minus log(result).where min(date) There are only two dates for each name/study/group, so the result from the maximum data (log) minus the result from the minumum date (log). here is what I have tried so far with no luck:
var result = from results in sortedData.AsEnumerable() group results by results.animal into grp select new { animal = results.animal, study = results.study, groupNumber = results.groupNumber, TGI = System.Math.Log(grp.Select(c => c.volume) .Where(grp.Max(c=>c.operationDate))) - System.Math.Log(grp.Select(c => c.volume) .Where(grp.Min(c => c.operationDate))) }; Anybody any pointers? Thanks.