expect_column_unique_value_count_to_be_between
Feb 24, 2026
·
5
min read
Uniqueness
·
dbt-expectations
·
Column
How it Works
The expect_column_unique_value_count_to_be_between test from the dbt-expectations package checks that the count of distinct values in a column falls within a specified minimum and maximum. This is a softer version of exact distinct count checks and is well-suited for columns whose cardinality is expected to grow over time but within predictable bounds.
Steps and Conditions
Column Selection: Identify the column to evaluate.
Define Range: Set
min_valueand/ormax_value.Execution: The distinct count is computed and compared to the range.
Outcome: Pass if the count is within range; fail otherwise.
Example Usage: Platform Analytics
A platform analytics team expects their active_experiment column to contain between 5 and 50 distinct experiment IDs at any given time.
Fewer than 5 distinct experiments suggests experiments are being dropped; more than 50 could indicate runaway experiment proliferation.





