This one should work. Note that Include
is introduced just for loading related data, not filtering main records.
var numRows = await applicationDbContext.TimeLogs
.Where(t => t.IsBillable == true && t.IsActive == true
&& !t.Invoices.Where(i => i.IsActive == true).Any())
.CountAsync();
CLICK HERE to find out more related problems solutions.