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

# Define reusable warehouse metrics

> Have your agent define a reusable warehouse metric and check its meaning.

[Agent guide: CLI and SDK instructions →](/docs/semantic-layer)

## 1. Have your context ready

Have a connected warehouse, one physical table, a known query result, and a precise business definition.

## 2. Ask your agent

Paste this into your agent, then provide your task and example inputs when it asks:

```deepline-prompt theme={null}
/deepline-analytics Prepare a small semantic layer for the metric I describe using the current supported Snowflake connector. Inspect the actual columns and row grain. Validate the proposed definition, then compare a representative semantic query with direct SQL for the same population. Specify filters explicitly; do not assume base filters or relationship annotations are applied automatically. Show the comparison before saving a changed model.
```

Complete any requested sign-in yourself. Give the agent the missing information before approving execution. Provider-backed work can incur usage.

## 3. Review the result

The rendered query and returned values match the intended business definition. A valid model file does not establish table existence or metric correctness.

Ask your agent:

```deepline-prompt theme={null}
/deepline-analytics Compare the result with the acceptance rule we agreed. Show the evidence for accepted and rejected outcomes, unresolved questions, and recorded Deepline usage where work ran. If work is still running or a response is uncertain, inspect the original saved execution before proposing another request. Explain the next decision I need to make.
```

Approve a larger job, recurring work, or external changes only after reviewing that decision.

## Check your understanding

The agent says the model is valid. Does that prove the metric has the intended business meaning?

> **Show the answer**
>
> No. Ask it to compare representative results with the known query and your
> intended population and row grain.

## Related guides

* [Semantic-layer reference](/docs/semantic-layer-reference)


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