Skip to content

Fix Power BI Costs query type mismatch on VCPUs/vCores cast - #2305

Draft
Michael Flanakin (flanakin) wants to merge 2 commits into
devfrom
flanakin/fix-costs-vcpus-type-mismatch-2297
Draft

Fix Power BI Costs query type mismatch on VCPUs/vCores cast#2305
Michael Flanakin (flanakin) wants to merge 2 commits into
devfrom
flanakin/fix-costs-vcpus-type-mismatch-2297

Conversation

@flanakin

Copy link
Copy Markdown
Collaborator

🛠️ Description

The storage-based Power BI Costs query cast tmp_VMvCPUs/tmp_SQLvCores (values extracted from the free-form x_SkuDetails JSON blob) straight to Int64.Type via Table.TransformColumnTypes. That blob's shape varies by charge type (VM usage, Marketplace/SaaS purchase, reservation purchase, etc.), so on a row where the VCPUs/vCores field isn't a clean number, the cast produced an Error value instead of throwing during query evaluation. When that error-valued cell was loaded into the model as an Int64 column, Power BI surfaced it during refresh as:

OLE DB or ODBC error: Type mismatch (DISP_E_TYPEMISMATCH 0x80020005)

A single month often has no such rows, so it refreshes fine; a full-year refresh pulls in the row that trips it, matching the report.

This switches the cast to Table.TransformColumns with a try ... otherwise null guard, mirroring the existing defensive pattern used for x_SkuTerm (#2175) — an unparseable or missing value now degrades to null instead of failing the whole refresh.

Fixes #2297

📷 Screenshots

N/A (Power Query/M change, no visual change)

📋 Checklist

🔬 How did you test this change?

  • 🤏 Lint tests
  • 🤞 PS -WhatIf / az validate
  • 👍 Manually deployed + verified
  • 💪 Unit tests
  • 🙌 Integration tests

No automated test coverage exists for Power Query/M logic in this repo, and I don't have a Power BI Desktop environment connected to the reporter's storage account to reproduce the failure live, so this hasn't been verified against real failing data. I read through the full Costs.tmdl M query and confirmed the Table.TransformColumnTypes call at the reported line is the only unguarded numeric cast on a value sourced from the SKU details JSON blob, and confirmed the replacement Table.TransformColumns syntax is valid M.

📦 Deploy to test?

  • Hubs + ADX (managed)
  • Hubs + Fabric (manual) — URI:
  • Hubs (manual)
  • Hubs (no data)
  • Workbooks
  • Alerts

🙋‍♀️ Do any of the following that apply?

  • 🤏 The change is less than 20 lines of code.

📑 Did you update docs/changelog.md?

  • ✅ Updated changelog (required for dev PRs)

📖 Did you update documentation?

  • ✅ Public docs in docs (required for dev)
  • ✅ Public docs in docs-mslearn (required for dev)
  • ✅ Internal dev docs in docs-wiki (required for dev)
  • ✅ Internal dev docs in src (required for dev)
  • ❎ Docs not needed (small/internal change)

🤖 Generated with Claude Code

…orage Costs query

The storage-based Costs query cast tmp_VMvCPUs/tmp_SQLvCores (extracted
from the x_SkuDetails JSON blob) straight to Int64.Type. Rows where that
field isn't a clean number -- e.g. Marketplace/SaaS, reservation
purchase, or other non-VM/SQL charge rows -- produced an Error value
that surfaced as an OLE DB "Type mismatch (DISP_E_TYPEMISMATCH)" error
during refresh once enough months/rows were pulled in. Switched to
Table.TransformColumns with a try/otherwise guard, matching the
existing x_SkuTerm defensive-cast pattern (PR #2175), so an unparseable
value degrades to null instead of failing the refresh.

Fixes #2297
@microsoft-github-policy-service microsoft-github-policy-service Bot added Micro PR 🔬 Very small PR that should be especially easy for newcomers Needs: Documentation 📝 PR needs a changelog entry, public docs, or internal docs before it can be closed labels Sep 8, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown

@Michael Flanakin (@flanakin), thanks for the PR. It looks like you forgot to indicate whether the documentation was updated as part of the PR. Please edit the PR to select (x) the appropriate items in the checklist. This PR will be blocked until one of the values is selected.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs: Review 👀 PR that is ready to be reviewed and removed Needs: Documentation 📝 PR needs a changelog entry, public docs, or internal docs before it can be closed labels Sep 8, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs: Documentation 📝 PR needs a changelog entry, public docs, or internal docs before it can be closed and removed Needs: Documentation 📝 PR needs a changelog entry, public docs, or internal docs before it can be closed labels Sep 8, 2026
@flanakin Michael Flanakin (flanakin) added this to the v16 milestone Sep 8, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs: Documentation 📝 PR needs a changelog entry, public docs, or internal docs before it can be closed label Sep 8, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown

@Michael Flanakin (@flanakin), thanks for the PR. It looks like you forgot to indicate whether the documentation was updated as part of the PR. Please edit the PR to select (x) the appropriate items in the checklist. This PR will be blocked until one of the values is selected.

@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs: Documentation 📝 PR needs a changelog entry, public docs, or internal docs before it can be closed label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Micro PR 🔬 Very small PR that should be especially easy for newcomers Needs: Review 👀 PR that is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OLE DB Type Mismatch in Costs query during Power BI refresh of FinOps Hub data

2 participants