The
.QueryByCube() function provided by AdaptiveLINQ (www.adaptivelinq.com) is designed to make this kind of query (multi-dimesensional analysis query).
It doesn't use dynamic LINQ but transforms the query based on grouping criteria expressed by the selection.
For example, you can write:
"Count by type":
dt.QueryByCube(yourCubeDefinition)
.Select(x => new {
Type = x.Type,
Count = c.Count
})
"Count by color":
dt.QueryByCube(yourCubeDefinition)
.Select(x => new {
Color = x.Color,
Count = c.Count
})
"Count by type and color":
dt.QueryByCube(yourCubeDefinition)
.Select(x => new {
Type = x.Type,
Color = x.Color,
Count = c.Count
})