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

# Metrics

> Define and query metrics.

<div />

Metrics are data aggregations that add business context to your data.

You can define metrics [inline](#in-line-metrics) or as [pre-defined](#pre-defined-metrics) to ensure consistent usage across your application.

<CardGroup cols={2}>
  <Card title="Types of metrics" icon="list" href="/docs/query-apis/types-of-metrics">
    Learn about the different types of metrics.
  </Card>

  <Card title="Defining metrics" icon="calculator-simple" href="/docs/query-apis/defining-metrics">
    Define metrics using the console, API, or Terraform.
  </Card>
</CardGroup>

## Querying Metrics

You can query metrics using the GraphQL API. Metrics can be queried either by [defining them inline](#in-line-metrics) or by [referencing pre-defined metrics](#pre-defined-metrics).

### In-line Metrics

You can define Metrics in line in your query.

```graphql Query theme={"system"}
query TimeSeriesExample {
  timeSeries(input: {
    metric: {
      count: {
        dataPool: {
          name: "TacoSoft Demo Data"
        }
      }
    }
    ...
  }) {
    ...
  }
}
```

### Pre-defined Metrics

You can predefine Metrics to ensure consistent usage across your application. Learn more about [Defining Metrics](/docs/query-apis/defining-metrics).

Query using a pre-defined Metric ID:

```graphql Query theme={"system"}
query TimeSeriesExample {
  timeSeries(input: {
    metric: {
      id: "METXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
    ...
  }) {
    ...
  }
}
```

Query using a pre-defined Metric name:

```graphql Query theme={"system"}
query TimeSeriesExample {
  timeSeries(input: {
    metric: {
      name: "sales"
    }
    ...
  }) {
    ...
  }
}
```
