Skip to content

Power BI Error When Recreating Conditional Flag Logic Outside Cube.js Model (PostgreSQL Connector, Databricks Backend) #10028

@mohammad0971

Description

@mohammad0971

Summary:
I'm using Cube.js as a semantic layer over Databricks, and connecting Power BI via the PostgreSQL connector. I’ve defined a conditional flag (customerRegionFlag) in the Customers cube using a case block. When this logic is defined inside the Cube.js model, it works perfectly — even when combined with measures from the Orders cube.

However, when I recreate the same logic in Power BI (e.g., using DAX or query editor), and combine it with a measure like totalAmount, I get the following error:

Error Message:

OLE DB or ODBC error: [DataSource.Error] PostgreSQL: XX000: Arrow error: Compute error: Unable to map value Number(-167142707430404.1) to Decimal(38, 10).

Model Setup:

Orders cube: contains totalAmount measure.
Customers cube: joined via customer_id, contains customerRegionFlag defined as:

customerRegionFlag: {
  type: `number`,
  case: {
    when: [
      { sql: `${CUBE}.region = 'North'`, label: `1` }
    ],
    else: { label: `0` }
  }
}

Observations:

The logic works when defined in Cube.js and used in Power BI visuals with measures.
The error occurs only when recreating the same logic in Power BI, not in the model.
Both fields are numeric; no type mismatch.
The error seems related to how Power BI processes the combined result outside Cube.js.

Is there a known limitation when recreating Cube.js logic in Power BI using the PostgreSQL connector?
Should all conditional logic be defined in the Cube.js model to avoid such errors?
Any recommended workaround or best practices?

Metadata

Metadata

Assignees

Labels

api:sqlIssues related to SQL APIquestionThe issue is a question. Please use Stack Overflow for questions.tool:power-bi

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions