I'm trying to figure out the correct syntax to make it work. Here's an example. Could you correct it/translate it into linq syntax?
From p In products()
group p by p.Category into g
select new { Category = g.Key,
TotalUnitsInStock = if(g.key="b", g.Avg(p => p.UnitsInStock),
g.Sum(p => p.UnitsInStock))
Products would be a datatable in this example. Thanks.