MetricSign
EN|NLRequest Access
Medium severityquery

Power BI Refresh Error:
UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY

What does this error mean?

A subquery was used in a position or with a pattern that Spark SQL does not support. This commonly occurs with correlated subqueries that reference outer-query columns in unsupported ways.

Common causes

  • 1Correlated subquery in a SELECT list that references multiple outer columns in an unsupported combination
  • 2Subquery inside an IN clause that also references an outer-query column (non-equi correlated IN)
  • 3Scalar subquery that returns more than one column
  • 4Subquery in an aggregate function argument
  • 5LATERAL subquery pattern not supported in the current Databricks Runtime version

How to fix it

  1. 1Rewrite correlated subqueries as JOINs or LEFT JOINs with aggregate subqueries in the ON or USING clause
  2. 2Replace IN (subquery) with EXISTS or a JOIN to gain more control over correlation
  3. 3Materialise the subquery as a CTE (WITH clause) and then join to it
  4. 4For window-function alternatives, use PARTITION BY to replicate correlated aggregation
  5. 5Check the Databricks Runtime release notes — some correlated subquery patterns were added in later versions

Frequently asked questions

Does Databricks support correlated subqueries at all?

Yes — Databricks supports many correlated subquery patterns, particularly simple equi-correlated EXISTS and scalar subqueries. Complex multi-column correlations and non-equi correlations in IN clauses have more restrictions.

Other query errors