expect_table_row_count_to_equal_other_table_times_factor
Feb 24, 2026
·
5
min read
Volume, Tables relationship
·
dbt-expectations
·
Model,Seed,Source
How it Works
The expect_table_row_count_to_equal_other_table_times_factor test from the dbt-expectations package validates that the row count of one model equals the row count of a reference model multiplied by a constant factor. This is particularly useful for models that fan out from a parent (e.g., generating one row per metric per entity).
Steps and Conditions
Reference Model: Specify the comparison model using
compare_model.Factor: Define the multiplication factor.
Execution: Both row counts are computed; the reference count is multiplied by the factor and compared.
Outcome: Pass if counts match; fail if they differ.
Example Usage: Metric Fanout
A data team generates one row per metric per user in a user_metrics model, with 5 metrics per user. The users model has the base row count.
If any user is missing some metrics or extra metrics are generated, the row count will deviate and the test will fail.





