> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a reusable metric

> Save validated, versioned SQL as a metric your project can reuse.

export const DocMeta = ({type, applies, owner}) => {
  const LABELS = {
    tutorial: "Tutorial",
    "how-to": "How-to guide",
    explanation: "Explanation",
    reference: "Reference"
  };
  return <div className="e6-meta">
      <span className={type === "how-to" || type === "tutorial" ? "e6-eyebrow" : "e6-eyebrow e6-eyebrow--quiet"}>{LABELS[type] || type}</span>
      {applies ? <span>Applies to: {applies}</span> : null}
      {owner ? <span>Owner: {owner}</span> : null}
    </div>;
};

<DocMeta type="how-to" applies="All deployments" />

A metric is a project-scoped, saved SQL definition with a name and description. Metrics capture repeatable intelligence so AgentFlow can **anticipate** what matters as new data arrives.

## Create a metric

1. Open **Metrics** in a ready project.
2. Choose **Create metric**.
3. Enter a name, an optional description, and the SQL.
4. Select **Validate SQL** and wait for the query to succeed against the project's bound view.
5. Create the metric.

The SQL must validate against the project's bound e6data view before the metric can be created.

## Versions

Metrics are versioned. Edit a version, create another version, or promote an existing version to current.

## What a metric doesn't include

The metric definition is deliberately narrow. It doesn't embed schedules, thresholds, alerts, dimensions, drivers or AI-generated SQL. To run a metric on a schedule or react to it, use it in a [workflow](/agentflow/automate/build-in-chat).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.