Getting Started with AQL
AQL (Analytics Query Language) is Holistics' powerful language for defining metrics, dimensions, and business logic in your semantic layer. It enables you to create reusable analytics components that adapt dynamically to any context.
What is AQL?
AQL is a declarative language designed specifically for analytics. Unlike SQL which focuses on data transformation, AQL focuses on business metrics and their relationships.
Key benefits:
- Reusable metrics - Define once, use everywhere
- Context-aware - Metrics adapt automatically to filters, grouping, and time periods
- Composable - Build complex metrics from simpler ones
- Business-friendly - Express logic in terms users understand
Quick Example
Here's a simple AQL metric that calculates revenue:
metric revenue {
label: 'Revenue'
type: 'number'
definition: @aql sum(order_items, order_items.quantity * products.price) ;;
}
This metric can be used in any report, automatically adapting to whatever dimensions, filters, or time periods users apply.
Learning Path
1. First Steps
- Where to Define AQL - Learn where you can write AQL expressions in Holistics
- AQL in Action - See practical e-commerce examples demonstrating AQL capabilities
2. For SQL Users
- From SQL Background - Comprehensive guide for SQL practitioners transitioning to AQL
3. Deep Dive
- AQL Concepts - Understand how AQL works under the hood
- Level of Detail - Master advanced aggregation patterns
Common Use Cases
AQL excels at:
- Period comparisons - Year-over-year, month-over-month growth
- Nested aggregations - Average order value, conversion rates
- Cross-model calculations - Revenue per user, product adoption metrics
- Time intelligence - Running totals, moving averages, cohort analysis
Need Help?
Enable AQL
If you signed up before April 19, 2024, you may need to enable AQL for your datasets.
Resources
- AQL Cheatsheet - Quick reference for functions and syntax
- Examples by Use Case - Common patterns and solutions
- Community Forum - Get help from the Holistics community