expect_column_mean_to_be_between
Feb 24, 2026
·
5
min read
Values distribution
·
dbt-expectations
·
Column
How it Works
The expect_column_mean_to_be_between test from the dbt-expectations package validates that the arithmetic mean of a numeric column's values falls within a defined range. This guards against data issues that shift the average — such as erroneous zero values inflating or deflating the mean, or data truncation removing high-value records.
Supports group_by, row_condition, and strictly for exclusive comparisons.
Steps and Conditions
Column Selection: Choose the numeric column to evaluate.
Define Range: Set
min_valueand/ormax_valuefor the acceptable mean.Optional Config: Apply
group_by,row_condition, andstrictlyas needed.Execution: The mean is computed and compared to the range.
Outcome: Pass if within range; fail otherwise.
Example Usage: Customer Success
A customer success team tracks average NPS scores per quarter. The mean score should remain between 20 and 80 — extreme deviations likely indicate data collection errors.
A mean outside this range prompts a review of the NPS data collection pipeline.





