AQLearn / Core mental model

Three AQL Shapes

Tangible win: after this lesson, you can choose whether a business question needs a metric expression, table expression, or explore expression.

Why this matters for your mission: most AMQL/AQL debugging starts by asking “what shape am I looking at?” If shape is wrong, metric definitions, relationships, and customer explanations become confusing fast.

1. Metric expression: reusable business number

A metric expression returns an aggregate value. Its value changes with report context: dimensions, filters, relationships, level of detail, or windows. Official docs call this metric context.

count(orders.id)
sum(order_items.quantity * products.price)

Use this when logic should be reused: revenue, total orders, retention, AOV.

2. Table expression: explicit rows

A table expression returns a table. It works like a small pipeline: start from a model, then filter/group/select. Holistics docs compare it to SQL-style table output.

orders
  | group(orders.created_at | month())
  | select(
      order_month: orders.created_at | month(),
      total_orders: count(orders.id)
    )

Use this when you care about exact row/table shape or need post-aggregation filtering.

3. Explore expression: report query

An explore expression is report-shaped: dimensions, measures, filters. Holistics automatically chooses source tables from selected fields.

explore {
  dimensions {
    order_month: orders.created_at | month()
  }

  measures {
    revenue
  }

  filters {
    orders.created_at matches @2024
  }
}

Use this when answering a dashboard/presales question: “show revenue by month in 2024.”

Practice: choose the shape

Pick the best AQL shape for each task. Feedback is instant.

A. Define “delivered orders” once so every dashboard can reuse it.
B. Show revenue by country for a customer demo.
C. Produce a table of countries with at least 100,000 buyers after aggregation.

Read next

Primary source: Holistics: What AQL is for. Focus on “same metric, three reports.”

Reference sheet: AQL Core Shapes.