# Retention rate: Formula and dbt YAML | Silicon

URL: https://meetsilicon.com/metrics/retention-rate/

> Retention rate is the percentage of customers at the start of a period who are still customers at the end of it.

## Formula
Retention rate = customers retained / customers at start of period
## Why it matters
Retention compounds. Small improvements in retention have a larger long-term effect on revenue than equal improvements in acquisition.
## Common pitfalls
- Exclude customers acquired during the period from the calculation.
## Define it in dbt for Silicon
Add this to your model's YAML. Aggregate metrics sit under a column's meta.metrics; ratios are type: number metrics that reference other metrics. Rename models and columns to match your project.
schema.yml Copy
models:
- name: fct_customer_periods
meta:
metrics:
retention_rate:
type: number
sql: ${customers_retained} / NULLIF(${customers_at_start}, 0)
format: percent
description: Share of customers retained
columns:
- name: customer_id
meta:
metrics:
customers_at_start:
type: count_distinct
filters:
- was_active_at_start: true
description: Customers active at period start
- name: retained_customer_id
meta:
metrics:
customers_retained:
type: count_distinct
description: Start customers still active at period end
Once it's defined, anyone can ask about retention rate in plain English and get an answer built on this definition. See the metrics reference for every option.
## Related
- Churn rate ->
- Net revenue retention (NRR) ->
- Average revenue per user (ARPU) ->
- Semantic layer ->
## Tell us where your data lives today.
Book 30 minutes with the founder. Tell us where your data is today, and see Silicon running on sample data.
Talk to Sujay
30-minute call with the founder
