How metrics work

Why Orcabase asks you to define each number once, and how data models, metrics and metric queries fit together to keep answers consistent.

Ask three people what “revenue” means and you can get three answers: every order, only paid orders, or paid orders minus refunds. A chart built on the wrong one looks just as convincing as the right one. So does an AI answer. The fix is to write each definition down once, check it, and have everything use it. In Orcabase, that’s the semantic layer: data models and metrics.

Data model

orders

Group by created_at and plan. Add up paid_amount.

Metric

Revenue ✓

Sum of paid order amounts, refunds excluded. Certified by Finance.

Metric query

Revenue by month

Last 90 days, split by plan.

Result

A chart, anywhere

The same number on dashboards, in the agent and in Claude.
A metric is asked for by name. Orcabase writes the SQL for your database each time, from the current definitions.

The three pieces

  • A data model describes one table in business terms: what you can group and filter by (dimensions, like order date, plan or country), what you can add up or count (measures, like paid amount or number of orders) and how it joins to other tables.
  • A metric is a named business number built on a model’s measure, with a description, an owner and a format: Revenue, Average order value, Net revenue. Someone checks it and clicks Certify, and it becomes the definition everyone uses.
  • A metric query asks for metrics by name: Revenue, by month, split by plan, last 90 days. Orcabase writes the SQL for your database from the current definitions.

Why it’s worth the few minutes

  • One number everywhere. Dashboards, notebooks, the Data Agent and Claude or ChatGPT all get Revenue from the same definition, so they agree.
  • Fix it once. Saved metric queries store the metric’s name, not SQL. Change the definition and every chart that uses it is right on its next run.
  • Better AI answers. The agent checks your certified metrics first, and says which definition it used. Without them, it has to guess what your columns mean from their names.
  • Clear ownership. Every change is recorded with who made it, and a certified metric shows who vouched for it.

Correct or loud, never wrong

Some questions can’t be answered safely from a model. The classic case: adding up order amounts while splitting by product, when each order has several products, counts every order once per product and inflates revenue. Orcabase checks each join’s relationship, and refuses a query like that with an explanation instead of returning a plausible wrong number:

For example

orders can’t be grouped or filtered by order_items: the path orders → order_items crosses a one-to-many join and would double-count. Define the metric on order_items.

Get started

The quickest start is to ask the agent: “Model our orders table and draft a revenue metric.” It reads the table, drafts a model and a metric, and tests them. You review and certify. To do it by hand, start from a table in Explore.

Something unclear or missing? Troubleshooting covers the common errors, or message us.

↑↓ to move↵ to openesc to close