MetricSign
EN|NLRequest Access
Medium severitydata quality

Power BI Refresh Error:
Test Failure: expression_is_true

What does this error mean?

dbt's expression_is_true test (from dbt_utils) found rows where a custom SQL expression evaluated to false or NULL. This generic test allows teams to encode arbitrary business rules — like amount >= 0 or end_date >= start_date — as testable assertions in schema.yml.

Common causes

  • 1A business rule constraint is violated in the source data — e.g., a negative order amount or an end date before a start date
  • 2A transformation bug inverted a calculation or applied a filter incorrectly, producing values that break the expected constraint
  • 3NULL values in one of the expression's columns cause the expression to evaluate to NULL (which is treated as false by the test)
  • 4The expression references a column that changed data type after a schema migration, causing unexpected comparison behaviour
  • 5The test expression itself has a logic error — the SQL is valid but the condition is more or less restrictive than intended

How to fix it

  1. 1Run `dbt test --select <test_name> --store-failures` to write failing rows to the audit schema for direct inspection.
  2. 2Query the failing rows and trace the values back to the source — determine whether the bad data originated upstream or was introduced by a transformation.
  3. 3Check for NULLs in the columns used in the expression: `expression_is_true` fails on NULL by default. Add a COALESCE or IS NOT NULL guard if NULLs are acceptable.
  4. 4Review the expression in schema.yml and verify the SQL logic matches the intent — test it manually in a warehouse SQL editor against sample data.
  5. 5If some violations are acceptable (e.g., legacy data), add a `where:` condition to the test config to exclude known exceptions.

Frequently asked questions

How do I write an expression_is_true test in schema.yml?

Under the model's `tests:` or `columns:` section: `- dbt_utils.expression_is_true: {expression: "amount >= 0"}`. For column-level tests, the column name is automatically available as the expression variable.

Can I exclude specific rows from the expression_is_true test?

Yes — add a `where:` config: `config: {where: "created_at >= '2020-01-01'"}` to restrict the test to a subset of rows.

Other data quality errors