diff --git a/soda-core/src/soda_core/contracts/impl/contract_verification_impl.py b/soda-core/src/soda_core/contracts/impl/contract_verification_impl.py index eca66f25d..3b46144cf 100644 --- a/soda-core/src/soda_core/contracts/impl/contract_verification_impl.py +++ b/soda-core/src/soda_core/contracts/impl/contract_verification_impl.py @@ -1741,8 +1741,9 @@ def compute_derived_value(self, measurement_values: MeasurementValues) -> Option if values is None: return None fraction, total = values - return (fraction * 100 / total) if total != 0 else 0 - + if total == 0: + return None # No rows to evaluate; let evaluate_threshold return NOT_EVALUATED + return fraction * 100 / total class ValidCountMetric(AggregationMetricImpl): """TODO -- 3/10/2025: this metric is not used anywhere in the codebase, it's not clear if it's needed."""