Understanding the GROUP BY clause
Aggregate data is what reports are made of; speaking ANSI SQL, this means GROUP BY
. MicroStrategy applies GROUP BY
to all the attributes present on a report grid. Well, this is not completely correct, but we begin with this simple concept:
Every attribute on a grid is reflected in the GROUP BY
clause of the resulting SELECT
statement.
Hence, we have:
- Metrics that represent the aggregation (sum, count, and so on) of facts
- Attributes
BY
which weGROUP
the data
I hope this is clear enough, because this concepts will return every now and then with metrics. In this recipe, anyway, we'll see an example of how it works.
Getting ready
We are using now the SalesAmount
metric and the Product
attribute. Before going on we need ...
Get Business Intelligence with MicroStrategy Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.