Dynamic LINQ aggregates on IQueryable as a single query <p>I'm building a datagrid library that works on generic IQueryable data sources. At the bottom selected columns will have aggregates: sum, average, count etc.</p> <p>I can compute the sum/average/count individually using the code from this article <a href="http://stackoverflow.com/questions/17490080/how-to-do-a-sum-using-dynamic-linq">How to do a Sum using Dynamic LINQ</a> </p> <p>I don't want to run them individually for a datasource, as this would cause multiple queries on the database, I would rather create a single expression tree an execute this as a single query.</p> <p>In static LINQ you'd do all the .Sum, .Average and .Count methods and return a new anonymous type with the values. I don't need an anonymous type (unless this is the only way): a list or array of the aggregates would be fine.</p> <p>I assume from the other article I would need to string together a series of MethodCallExpression objects somehow. Can anyone help?</p>