The query you have posted is a nice and complex one and unfortunately we are unable to handle it properly as you have seen.
We have found a work around for this issue that requires slight modifications to the query:
var ApptList = from a
where a.RespiteDateIn >= dtmStart.ToUniversalTime() && a.RespiteDateIn < dtmEnd.ToUniversalTime()
group a by a.AppointmentType.TypeName into g
VisitType = g.Key,
TotalHours = (g.Count() == 0 ? 0 : g.Sum(a => a.TotalMinutes)) / 60,
TotalAppts = g.Count(),
CancelledHours = g.Sum(c => c.CurrentStatusID == 3 ? a => a.TotalMinutes : 0) / 60,
CancelledAppts = g.Sum(c => c.CurrentStatusID == 3 ? 1 : 0)
Important changes are on lines 9 and 10
- we are summing all records, but the ones that do not match our criteria have value of 0
If you consider the changes that we have made safe you can apply them to your code.
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!