expect_row_values_to_have_data_for_every_n_datepart
Feb 24, 2026
·
5
min read
Completeness, Freshness
·
dbt-expectations
·
Model,Source
How it Works
The expect_row_values_to_have_data_for_every_n_datepart test from the dbt-expectations package validates that a model contains at least one row for every interval within a specified date range. This is critical for time-series models where gaps in the date spine would silently break cumulative calculations, trend lines, or period-over-period comparisons.
Key arguments include date_col, date_part, interval, start_date, and end_date.
Steps and Conditions
Date Column: Specify the timestamp or date column using
date_col.Date Part & Interval: Define the expected granularity (e.g., every 1 day, every 1 hour).
Date Range: Set the expected
start_dateandend_date.Execution: A date spine is generated and compared against the model's actual date values.
Outcome: Pass if all expected intervals are present; fail if any gaps exist.
Example Usage: Daily Reporting
A daily sales reporting model must have exactly one row per day for the full reporting period. Any missing day would break cumulative and rolling average calculations.
Any missing day in the reporting period surfaces as a test failure, protecting the integrity of cumulative sales metrics.





