From 298008341619ba2cc882b6a04b35d9b9c3022c60 Mon Sep 17 00:00:00 2001 From: Michael Flanakin Date: Mon, 7 Sep 2026 19:04:26 -0700 Subject: [PATCH 1/2] fix(power-bi): coerce VCPUs/vCores to null on unparseable value in storage 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 --- docs-mslearn/toolkit/changelog.md | 2 ++ .../storage/Shared.Dataset/definition/tables/Costs.tmdl | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs-mslearn/toolkit/changelog.md b/docs-mslearn/toolkit/changelog.md index c9a66fcd1..cc66414b2 100644 --- a/docs-mslearn/toolkit/changelog.md +++ b/docs-mslearn/toolkit/changelog.md @@ -57,6 +57,8 @@ The following section lists features and enhancements that are currently in deve - **Changed** - Switched the InstanceSizeFlexibility table in the storage and KQL shared datasets from the retired `ccmstorageprod` AutofitComboMeterData.csv to the FinOps toolkit [Instance size flexibility](open-data.md#instance-size-flexibility) open data file, joined to reservation recommendations on the unique ARM SKU name ([#2090](https://github.com/microsoft/finops-toolkit/issues/2090)). +- **Fixed** + - Fixed the storage-based Costs query failing to refresh with `Type mismatch (DISP_E_TYPEMISMATCH 0x80020005)` when a row's SKU details didn't carry a clean numeric VCPUs/vCores value (for example, a Marketplace or reservation purchase row). The value is now coerced to null instead of throwing ([#2297](https://github.com/microsoft/finops-toolkit/issues/2297)). ### [Optimization Engine](optimization-engine/overview.md) diff --git a/src/power-bi/storage/Shared.Dataset/definition/tables/Costs.tmdl b/src/power-bi/storage/Shared.Dataset/definition/tables/Costs.tmdl index 75880048f..b34c2b71b 100644 --- a/src/power-bi/storage/Shared.Dataset/definition/tables/Costs.tmdl +++ b/src/power-bi/storage/Shared.Dataset/definition/tables/Costs.tmdl @@ -1683,14 +1683,15 @@ table Costs // TODO: Add SQL AHB handling AHB = Table.RemoveColumns( Table.AddColumn(Table.AddColumn(Table.AddColumn(Table.AddColumn(Table.AddColumn(Table.AddColumn(Table.AddColumn( - Table.TransformColumnTypes( + Table.TransformColumns( Table.ExpandRecordColumn( Table.ReplaceErrorValues(Table.AddColumn(ExtractedTags, "tmp_SkuDetails", each [x_SkuDetailsDictionary]), {{"tmp_SkuDetails", null}}), "tmp_SkuDetails", {"UsageType", "ImageType", "ServiceType", "VMName", "VMProperties", "VCPUs", "ReservationOrderId", "ReservationId", "VMCapacityReservationId", "AHB", "vCores", "ServerSku"}, {"x_SkuUsageType", "x_SkuImageType", "x_SkuType", "tmp_VMName", "x_SkuVMProperties", "tmp_VMvCPUs", "tmp_AddlReservationOrderId", "tmp_AddlReservationId", "x_CapacityCommitmentId", "tmp_SQLAHB", "tmp_SQLvCores", "tmp_ServerSku"} ), - {{"tmp_VMvCPUs", Int64.Type}, {"tmp_SQLvCores", Int64.Type}} + // Coerce to Int64, degrading any non-numeric/unexpected VCPUs/vCores value (e.g. on a Marketplace, reservation, or other non-VM/SQL charge row) to null instead of throwing a type mismatch error on refresh + {{"tmp_VMvCPUs", each try Int64.From(_) otherwise null, Int64.Type}, {"tmp_SQLvCores", each try Int64.From(_) otherwise null, Int64.Type}} ), "x_ResourceMachineName", each if _isNotBlank([tmp_VMName]) then [tmp_VMName] else null), "x_SkuCoreCount", each if [tmp_VMvCPUs] <> null then [tmp_VMvCPUs] else if [tmp_SQLvCores] <> null then [tmp_SQLvCores] else null, Int64.Type), From e813c4ec250ca2637028124001f51abc901c6dc2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 8 Sep 2026 02:05:27 +0000 Subject: [PATCH 2/2] chore: Update ms.date in docs-mslearn files --- docs-mslearn/toolkit/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-mslearn/toolkit/changelog.md b/docs-mslearn/toolkit/changelog.md index cc66414b2..c01b32db6 100644 --- a/docs-mslearn/toolkit/changelog.md +++ b/docs-mslearn/toolkit/changelog.md @@ -3,7 +3,7 @@ title: FinOps toolkit changelog description: Review the latest features and enhancements in the FinOps toolkit, including updates to FinOps hubs, Power BI reports, and more. author: MSBrett ms.author: brettwil -ms.date: 09/07/2026 +ms.date: 09/08/2026 ms.topic: reference ms.service: finops ms.subservice: finops-toolkit