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 data source. To derive visualizations 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({fact/sales_revenue} ) WHERE {label/region.name} = "West"