1

I'm trying to group my tickets by priority and figure out the average of time to resolve each ticket within those grouped priorities. I'm not sure how to go about getting the average in projection. How do I go about inserting the formula for the average in my projection, which is essentially number tickets devide by minElapse. It says minElapse is not in the current context. Being I'm grouping and using Let this is where I get confused on how to use the variable minElapse. Thanks

var results = from r in Tickets
where r.Team.Equals("ABC") && DateCreated >1330001100 && r.DateCreated<1350000000  //unix time
let minElapse = r.FinishDate - r.DateCreated
group r by r.priority into u
select new {  
    Priority = u.Key,
TicketCount = u.Count(),
AverageMin = u.Average( c => minElapse)
};

1 Answer 1

1

You could just make it not use a let:

var results = from r in Tickets
where r.Team.Equals("ABC") && r.DateCreated>1330001100 && r.DateCreated<1350000000
group r by r.priority into u
select new 
{  
    Priority = u.Key,
    TicketCount = u.Count(),
    AverageMin = u.Average(x => x.FinishDate - x.DateCreated)
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.