swadhinbiswas added:cookebook for this project · 8/1/2026
ce5d03e
23 lines · 509 Bytes
Raw Download

« Back to Index

Aggregation

Aggregations summarize data. Essential for BI dashboards.

Common Functions

  • SUM(), AVG(), COUNT(), MIN(), MAX()

Usage

We use aggregations extensively in our Gold layer (dbt marts) to create summary tables like airport_daily_metrics:

SELECT 
  date_key, departure_airport_key, 
  COUNT(*) as total_flights, 
  AVG(delay_minutes) as avg_delay
FROM fact_flights
GROUP BY 1, 2;

« Back to Index