Aggregation Functions
Aggregation refers to the computation of a function across a defined set of facts.
Facts are raw numerical data pulled from the source, which may be of limited value on their own. Examples of facts might include:
- Revenue earned from a sale
- Cost of some item purchased
- Hours worked by one employee
- Number of items shipped in a delivery
Facts are stored with contextual data in a raw form in the datastore. To derive insights from fact data, you must aggregate facts into metrics.
For example, you might sum all the sales revenue data (the Sales Revenue fact) for the entire country. Or you might slice this aggregation by a specific region of the country:
SELECT SUM( Sales Revenue ) WHERE Region = West
These aggregations, called metrics, are referenced by name in the Data Catalog of the Analytical Designer under the Analyze tab and you can use them in your insights. Metrics can also be referenced within the definitions of other metrics.
Use the following aggregations to form metrics:
For more information, see GoodData Glossary.
Metrics contain other interesting features. In the previous simple example, the WHERE
clause includes information that defines the range of facts across which the sum is computed. You can also apply any of the following types of operations within a metric definition: