MetricSign
EN|NLRequest Access
Medium severitycompilation

Power BI Refresh Error:
DbtSavedQueryError

What does this error mean?

A dbt saved query definition contains an invalid metric reference, incompatible dimension, or unsupported filter expression that prevents MetricFlow from compiling the query.

Common causes

  • 1A metric referenced in the saved query was renamed or deleted from the semantic models
  • 2A dimension used in the groupby or filter clause does not exist on the referenced metric's measure
  • 3The saved query uses a time grain that is not defined in the metric's time dimension
  • 4An incompatible combination of metrics (from different entities) was specified in the same saved query

How to fix it

  1. 1Step 1: Run dbt parse or dbt compile to see the full validation error for the saved query.
  2. 2Step 2: Verify all metrics listed in the saved query exist in your dbt semantic model definitions.
  3. 3Step 3: Confirm the dimensions and entities referenced in groupby and where clauses are valid for the specified metrics.
  4. 4Step 4: Check that the time grain (day, week, month) is defined in the metric's measure time dimension.
  5. 5Step 5: Test the saved query with dbt sl query before deploying to production.

Frequently asked questions

What is a dbt saved query and how does it differ from a dbt model?

A saved query is a pre-defined MetricFlow query in YAML that specifies metrics, dimensions, and filters. Unlike dbt models (SQL transformations), saved queries are consumed by BI tools through the semantic layer API without producing a database table.

Can I test a saved query locally before deploying to dbt Cloud?

Yes — use dbt sl query --metrics metric_name --group-by dimension_name to test MetricFlow queries locally with the dbt CLI.

Other compilation errors