From 72b6d20c64c91ab9ed218c5c0fca7d65f9823701 Mon Sep 17 00:00:00 2001 From: Michael Flanakin Date: Wed, 12 Aug 2026 10:30:58 -0700 Subject: [PATCH 1/3] Fix Data Explorer dashboard savings formulas and FX fallback (#2093) Replaces inline sum(ListCost) - sum(EffectiveCost) style savings calculations in dashboard.json with sum() of the canonical, row-level clamped columns (x_TotalSavings, x_CommitmentDiscountSavings, x_NegotiatedDiscountSavings) across 21 tiles. Raw subtraction of aggregated sums can diverge from the canonical clamped values. Also removes the silent 1:1 exchange-rate fallback (coalesce(x_BillingExchangeRate, real(1))) used when deriving CommitmentDiscountQuantity for spend-based commitments in HubSetup_v1_2.kql and IngestionSetup_v1_2.kql. When the rate is missing, the quantity (and any utilization built on it) is now left unset rather than silently distorted by the true FX factor. Addresses the remaining Phase 1.3 and savings-plan FX distortion items from #2093; BillingCurrency visibility in detail tables and the Phase 2 USD-normalization toggle remain out of scope. --- src/templates/finops-hub/dashboard.json | 42 +++++++++---------- .../Analytics/scripts/HubSetup_v1_2.kql | 5 ++- .../Analytics/scripts/IngestionSetup_v1_2.kql | 5 ++- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/templates/finops-hub/dashboard.json b/src/templates/finops-hub/dashboard.json index dab4f6b27..93e43b961 100644 --- a/src/templates/finops-hub/dashboard.json +++ b/src/templates/finops-hub/dashboard.json @@ -2873,31 +2873,31 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsPlus\n| where startofmonth(ChargePeriodStart) >= startofmonth(now(), -1)\n| summarize \n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost)\n by\n ChargePeriodStart,\n Month = strcat(format_datetime(ChargePeriodStart, 'MM '), monthname[monthofyear(ChargePeriodStart)])\n| extend CommitmentDiscountSavings = ContractedCost - EffectiveCost\n| extend NegotiatedDiscountSavings = ListCost - ContractedCost\n| order by ChargePeriodStart asc\n| extend EffectiveCostRunningTotal = row_cumsum(EffectiveCost, prev(Month) != Month)\n| extend CommitmentDiscountSavingsRunningTotal = row_cumsum(CommitmentDiscountSavings, prev(Month) != Month)\n| extend NegotiatedDiscountSavingsRunningTotal = row_cumsum(NegotiatedDiscountSavings, prev(Month) != Month)\n| project ChargePeriodStart, CommitmentDiscountSavingsRunningTotal, NegotiatedDiscountSavingsRunningTotal, EffectiveCostRunningTotal, Month\n| render areachart ", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsPlus\n| where startofmonth(ChargePeriodStart) >= startofmonth(now(), -1)\n| summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n by\n ChargePeriodStart,\n Month = strcat(format_datetime(ChargePeriodStart, 'MM '), monthname[monthofyear(ChargePeriodStart)])\n| order by ChargePeriodStart asc\n| extend EffectiveCostRunningTotal = row_cumsum(EffectiveCost, prev(Month) != Month)\n| extend CommitmentDiscountSavingsRunningTotal = row_cumsum(CommitmentDiscountSavings, prev(Month) != Month)\n| extend NegotiatedDiscountSavingsRunningTotal = row_cumsum(NegotiatedDiscountSavings, prev(Month) != Month)\n| project ChargePeriodStart, CommitmentDiscountSavingsRunningTotal, NegotiatedDiscountSavingsRunningTotal, EffectiveCostRunningTotal, Month\n| render areachart ", "id": "dcc1f533-e5f9-4855-9e4c-21e21fcdf943", "usedVariables": ["CostsPlus"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = materialize(\n CostsByMonth\n | where ChargePeriodStart >= startofmonth(now(), -1)\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost)\n by\n ChargePeriodStart\n | order by ChargePeriodStart asc\n | extend CommitmentDiscountSavings = ContractedCost - EffectiveCost\n | extend NegotiatedDiscountSavings = ListCost - ContractedCost\n | extend Month = monthname[monthofyear(ChargePeriodStart)]\n | project json = todynamic(strcat('[{ \"Type\":\"Billed cost\", \"Count\":', BilledCost, ' }, { \"Type\":\"Effective cost\", \"Count\":', EffectiveCost, ' }, { \"Type\":\"Commitment savings\", \"Count\":', CommitmentDiscountSavings, ' }, { \"Type\":\"Negotiated savings\", \"Count\":', NegotiatedDiscountSavings, ' }]')), Month, IsThisMonth = ChargePeriodStart >= startofmonth(now())\n | mv-expand json\n | project Label = strcat(json.Type, ' (', Month, ')'), Count = tolong(json.Count), IsThisMonth\n);\ndata", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = materialize(\n CostsByMonth\n | where ChargePeriodStart >= startofmonth(now(), -1)\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n by\n ChargePeriodStart\n | order by ChargePeriodStart asc\n | extend Month = monthname[monthofyear(ChargePeriodStart)]\n | project json = todynamic(strcat('[{ \"Type\":\"Billed cost\", \"Count\":', BilledCost, ' }, { \"Type\":\"Effective cost\", \"Count\":', EffectiveCost, ' }, { \"Type\":\"Commitment savings\", \"Count\":', CommitmentDiscountSavings, ' }, { \"Type\":\"Negotiated savings\", \"Count\":', NegotiatedDiscountSavings, ' }]')), Month, IsThisMonth = ChargePeriodStart >= startofmonth(now())\n | mv-expand json\n | project Label = strcat(json.Type, ' (', Month, ')'), Count = tolong(json.Count), IsThisMonth\n);\ndata", "id": "e8b343dc-7430-4487-8d44-ef48ac454f2d", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = todouble(round(sum(BilledCost), 2)),\n EffectiveCost = todouble(round(sum(EffectiveCost), 2)),\n ContractedCost = todouble(round(sum(ContractedCost), 2)),\n ListCost = todouble(round(sum(ListCost), 2))\n by\n ChargePeriodStart\n | order by ChargePeriodStart asc\n | extend CommitmentDiscountSavings = todouble(round(ContractedCost - EffectiveCost, 2))\n | extend NegotiatedDiscountSavings = todouble(round(ListCost - ContractedCost, 2))\n | extend ChargePeriod = strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)])\n);\ndata | extend Data = 'Billed cost' | evaluate pivot(ChargePeriod, sum(BilledCost), Data)\n| union (data | extend Data = 'Effective cost' | evaluate pivot(ChargePeriod, sum(EffectiveCost), Data))\n| union (data | extend Data = 'Negotiated savings' | evaluate pivot(ChargePeriod, sum(NegotiatedDiscountSavings), Data))\n| union (data | extend Data = 'Commitment savings' | evaluate pivot(ChargePeriod, sum(CommitmentDiscountSavings), Data))\n", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = todouble(round(sum(BilledCost), 2)),\n EffectiveCost = todouble(round(sum(EffectiveCost), 2)),\n CommitmentDiscountSavings = todouble(round(sum(x_CommitmentDiscountSavings), 2)),\n NegotiatedDiscountSavings = todouble(round(sum(x_NegotiatedDiscountSavings), 2))\n by\n ChargePeriodStart\n | order by ChargePeriodStart asc\n | extend ChargePeriod = strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)])\n);\ndata | extend Data = 'Billed cost' | evaluate pivot(ChargePeriod, sum(BilledCost), Data)\n| union (data | extend Data = 'Effective cost' | evaluate pivot(ChargePeriod, sum(EffectiveCost), Data))\n| union (data | extend Data = 'Negotiated savings' | evaluate pivot(ChargePeriod, sum(NegotiatedDiscountSavings), Data))\n| union (data | extend Data = 'Commitment savings' | evaluate pivot(ChargePeriod, sum(CommitmentDiscountSavings), Data))\n", "id": "c077a6d4-719f-42fe-b39b-36f77dc68976", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = todouble(round(sum(BilledCost), 2)),\n EffectiveCost = todouble(round(sum(EffectiveCost), 2)),\n ContractedCost = todouble(round(sum(ContractedCost), 2)),\n ListCost = todouble(round(sum(ListCost), 2))\n by\n ChargePeriodStart = startofmonth(ChargePeriodStart)\n | order by ChargePeriodStart asc\n | extend CommitmentDiscountSavings = todouble(round(ContractedCost - EffectiveCost, 2))\n | extend NegotiatedDiscountSavings = todouble(round(ListCost - ContractedCost, 2))\n | extend ChargePeriod = strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)])\n);\ndata | extend Data = 'Billed cost' | evaluate pivot(ChargePeriod, sum(BilledCost), Data)\n| union (data | extend Data = 'Effective cost' | evaluate pivot(ChargePeriod, sum(EffectiveCost), Data))\n| union (data | extend Data = 'Negotiated savings' | evaluate pivot(ChargePeriod, sum(NegotiatedDiscountSavings), Data))\n| union (data | extend Data = 'Commitment savings' | evaluate pivot(ChargePeriod, sum(CommitmentDiscountSavings), Data))\n//, BilledCost, NegotiatedDiscountSavings, CommitmentDiscountSavings)\n//| project ChargePeriod, BilledCost = round(BilledCost, 2), EffectiveCost = round(EffectiveCost, 2), NegotiatedDiscountSavings, CommitmentDiscountSavings\n", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = todouble(round(sum(BilledCost), 2)),\n EffectiveCost = todouble(round(sum(EffectiveCost), 2)),\n CommitmentDiscountSavings = todouble(round(sum(x_CommitmentDiscountSavings), 2)),\n NegotiatedDiscountSavings = todouble(round(sum(x_NegotiatedDiscountSavings), 2))\n by\n ChargePeriodStart = startofmonth(ChargePeriodStart)\n | order by ChargePeriodStart asc\n | extend ChargePeriod = strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)])\n);\ndata | extend Data = 'Billed cost' | evaluate pivot(ChargePeriod, sum(BilledCost), Data)\n| union (data | extend Data = 'Effective cost' | evaluate pivot(ChargePeriod, sum(EffectiveCost), Data))\n| union (data | extend Data = 'Negotiated savings' | evaluate pivot(ChargePeriod, sum(NegotiatedDiscountSavings), Data))\n| union (data | extend Data = 'Commitment savings' | evaluate pivot(ChargePeriod, sum(CommitmentDiscountSavings), Data))\n//, BilledCost, NegotiatedDiscountSavings, CommitmentDiscountSavings)\n//| project ChargePeriod, BilledCost = round(BilledCost, 2), EffectiveCost = round(EffectiveCost, 2), NegotiatedDiscountSavings, CommitmentDiscountSavings\n", "id": "3d947a7c-edca-46b5-a862-de77a725c85f", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost),\n SubAccountName = take_any(SubAccountName)\n by\n ChargePeriodStart = startofmonth(ChargePeriodStart),\n SubAccountId\n | as per\n | union (\n per\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost),\n SubAccountName = take_any(SubAccountName)\n by\n SubAccountId\n )\n | order by ChargePeriodStart asc\n | extend BilledCost = todouble(round(BilledCost, 2))\n | extend EffectiveCost = todouble(round(EffectiveCost, 2))\n | extend ContractedCost = todouble(round(ContractedCost, 2))\n | extend ListCost = todouble(round(ListCost, 2))\n | extend CommitmentDiscountSavings = todouble(round(ContractedCost - EffectiveCost, 2))\n | extend NegotiatedDiscountSavings = todouble(round(ListCost - ContractedCost, 2))\n | extend ChargePeriod = iff(isempty(ChargePeriodStart), strcat('Total'), strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)]))\n);\ndata | evaluate pivot(ChargePeriod, sum(EffectiveCost), SubAccountName)\n| order by Total desc", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n SubAccountName = take_any(SubAccountName)\n by\n ChargePeriodStart = startofmonth(ChargePeriodStart),\n SubAccountId\n | as per\n | union (\n per\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(NegotiatedDiscountSavings),\n SubAccountName = take_any(SubAccountName)\n by\n SubAccountId\n )\n | order by ChargePeriodStart asc\n | extend BilledCost = todouble(round(BilledCost, 2))\n | extend EffectiveCost = todouble(round(EffectiveCost, 2))\n | extend CommitmentDiscountSavings = todouble(round(CommitmentDiscountSavings, 2))\n | extend NegotiatedDiscountSavings = todouble(round(NegotiatedDiscountSavings, 2))\n | extend ChargePeriod = iff(isempty(ChargePeriodStart), strcat('Total'), strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)]))\n);\ndata | evaluate pivot(ChargePeriod, sum(EffectiveCost), SubAccountName)\n| order by Total desc", "id": "3886b5cd-34a8-42d7-9e16-33ea4d236953", "usedVariables": ["CostsByMonth"] }, @@ -2933,7 +2933,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost),\n SubAccountName = take_any(SubAccountName)\n by\n ChargePeriodStart,\n SubAccountId\n | as per\n | union (\n per\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost),\n SubAccountName = take_any(SubAccountName)\n by\n SubAccountId\n )\n | order by ChargePeriodStart asc\n | extend BilledCost = todouble(round(BilledCost, 2))\n | extend EffectiveCost = todouble(round(EffectiveCost, 2))\n | extend ContractedCost = todouble(round(ContractedCost, 2))\n | extend ListCost = todouble(round(ListCost, 2))\n | extend CommitmentDiscountSavings = todouble(round(ContractedCost - EffectiveCost, 2))\n | extend NegotiatedDiscountSavings = todouble(round(ListCost - ContractedCost, 2))\n | extend ChargePeriod = iff(isempty(ChargePeriodStart), strcat('Total'), strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)]))\n);\ndata | evaluate pivot(ChargePeriod, sum(EffectiveCost), SubAccountName)\n| order by Total desc", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n SubAccountName = take_any(SubAccountName)\n by\n ChargePeriodStart,\n SubAccountId\n | as per\n | union (\n per\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(NegotiatedDiscountSavings),\n SubAccountName = take_any(SubAccountName)\n by\n SubAccountId\n )\n | order by ChargePeriodStart asc\n | extend BilledCost = todouble(round(BilledCost, 2))\n | extend EffectiveCost = todouble(round(EffectiveCost, 2))\n | extend CommitmentDiscountSavings = todouble(round(CommitmentDiscountSavings, 2))\n | extend NegotiatedDiscountSavings = todouble(round(NegotiatedDiscountSavings, 2))\n | extend ChargePeriod = iff(isempty(ChargePeriodStart), strcat('Total'), strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)]))\n);\ndata | evaluate pivot(ChargePeriod, sum(EffectiveCost), SubAccountName)\n| order by Total desc", "id": "90502e9a-2d0d-4ae4-8d9d-cc21f9b72d5d", "usedVariables": ["CostsByMonth"] }, @@ -3011,13 +3011,13 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsByDay\n| where isnotempty(ResourceType)\n| summarize \n Count = dcount(ResourceId),\n EffectiveCost = sum(EffectiveCost),\n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost)\n by\n ResourceType\n| order by Count desc\n| project \n Type = ResourceType,\n Count,\n Cost = round(EffectiveCost, 2),\n // NegotiatedSavings = round(ListCost - ContractedCost, 2),\n // CommitmentSavings = round(ContractedCost - EffectiveCost, 2),\n Savings = round(ListCost - EffectiveCost, 2),\n [\"Cost / Resource\"] = round(EffectiveCost / Count, 2)\n", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsByDay\n| where isnotempty(ResourceType)\n| summarize \n Count = dcount(ResourceId),\n EffectiveCost = sum(EffectiveCost),\n Savings = sum(x_TotalSavings)\n by\n ResourceType\n| order by Count desc\n| project \n Type = ResourceType,\n Count,\n Cost = round(EffectiveCost, 2),\n Savings = round(Savings, 2),\n [\"Cost / Resource\"] = round(EffectiveCost / Count, 2)\n", "id": "2d7b6447-2769-40b8-958a-f252dab68b1e", "usedVariables": ["CostsByDay"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let costs = CostsByDay\n| where isnotempty(ResourceType);\ncosts | summarize Value = tostring(dcount(ResourceId)) by Label = \"Resources\", Order = 10\n| union (costs | summarize Value = tostring(dcount(ResourceType)) by Label = \"Resource types\", Order = 11)\n| union (costs | summarize Count = dcount(ResourceId) by Value = ResourceType | order by Count desc | limit 1 | extend Label = \"Most used\", Order = 21)\n| union (costs | summarize sum(EffectiveCost) by Value = ResourceType | order by sum_EffectiveCost desc | limit 1 | extend Label = \"Most cost\", Order = 22)\n| union (costs | summarize AllTypes = dcount(ResourceType), CommittedTypes = dcountif(ResourceType, isnotempty(CommitmentDiscountType)) by Label = \"Covered by commitment discounts\", Order = 31 | extend Value = strcat(round(1.0 * CommittedTypes / AllTypes * 100, 1), '%'))\n| union (costs | summarize Savings = sum(ListCost - EffectiveCost) by Value = ResourceType | order by Savings desc | limit 1 | extend Label = \"Most savings\", Order = 32)\n| union (costs | summarize CostPerResource = sum(EffectiveCost) / dcount(ResourceId) by Value = ResourceType | order by CostPerResource desc | limit 1 | extend Label = \"Most expensive (cost / resource)\", Order = 41)\n| union (costs | where ResourceType !in (CostsPlus | where ChargePeriodStart < ago(numberOfDays * 1d) - 1d | distinct ResourceType) | summarize Count = dcount(ResourceId) by ResourceType | order by Count desc | as d | count | extend Label = \"New in last n days\", Value = case(Count == 0, '(none)', Count == 1, toscalar(d | project ResourceType), strcat(toscalar(d | limit 1 | project ResourceType), ' and ', (Count - 1), ' more')), Order = 42)\n| order by Order asc\n", + "text": "let costs = CostsByDay\n| where isnotempty(ResourceType);\ncosts | summarize Value = tostring(dcount(ResourceId)) by Label = \"Resources\", Order = 10\n| union (costs | summarize Value = tostring(dcount(ResourceType)) by Label = \"Resource types\", Order = 11)\n| union (costs | summarize Count = dcount(ResourceId) by Value = ResourceType | order by Count desc | limit 1 | extend Label = \"Most used\", Order = 21)\n| union (costs | summarize sum(EffectiveCost) by Value = ResourceType | order by sum_EffectiveCost desc | limit 1 | extend Label = \"Most cost\", Order = 22)\n| union (costs | summarize AllTypes = dcount(ResourceType), CommittedTypes = dcountif(ResourceType, isnotempty(CommitmentDiscountType)) by Label = \"Covered by commitment discounts\", Order = 31 | extend Value = strcat(round(1.0 * CommittedTypes / AllTypes * 100, 1), '%'))\n| union (costs | summarize Savings = sum(x_TotalSavings) by Value = ResourceType | order by Savings desc | limit 1 | extend Label = \"Most savings\", Order = 32)\n| union (costs | summarize CostPerResource = sum(EffectiveCost) / dcount(ResourceId) by Value = ResourceType | order by CostPerResource desc | limit 1 | extend Label = \"Most expensive (cost / resource)\", Order = 41)\n| union (costs | where ResourceType !in (CostsPlus | where ChargePeriodStart < ago(numberOfDays * 1d) - 1d | distinct ResourceType) | summarize Count = dcount(ResourceId) by ResourceType | order by Count desc | as d | count | extend Label = \"New in last n days\", Value = case(Count == 0, '(none)', Count == 1, toscalar(d | project ResourceType), strcat(toscalar(d | limit 1 | project ResourceType), ' and ', (Count - 1), ' more')), Order = 42)\n| order by Order asc\n", "id": "f062533b-8c94-412f-bf83-0eb5cd06063d", "usedVariables": ["CostsByDay", "CostsPlus", "numberOfDays"] }, @@ -3071,25 +3071,25 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByMonth | extend Period = 'Last n months'\n | union (CostsByDay | extend Period = 'Last n days')\n | summarize\n ListCost = round(sum(ListCost), 2),\n ContractedCost = round(sum(ContractedCost), 2),\n EffectiveCost = round(sum(EffectiveCost), 2)\n by\n Period\n | project Period, json = todynamic(strcat('[{ \"Label\":\"Total\", \"Value\":', ListCost - EffectiveCost, ' }, { \"Label\":\"Negotiated\", \"Value\":', ListCost - ContractedCost, ' }, { \"Label\":\"Commitment\", \"Value\":', ContractedCost - EffectiveCost, ' }]'))\n | mv-expand json\n | project Label = tostring(json.Label), Value = tolong(json.Value), Period\n);\ndata\n", + "text": "let data = materialize(\n CostsByMonth | extend Period = 'Last n months'\n | union (CostsByDay | extend Period = 'Last n days')\n | summarize\n TotalSavings = round(sum(x_TotalSavings), 2),\n NegotiatedDiscountSavings = round(sum(x_NegotiatedDiscountSavings), 2),\n CommitmentDiscountSavings = round(sum(x_CommitmentDiscountSavings), 2)\n by\n Period\n | project Period, json = todynamic(strcat('[{ \"Label\":\"Total\", \"Value\":', TotalSavings, ' }, { \"Label\":\"Negotiated\", \"Value\":', NegotiatedDiscountSavings, ' }, { \"Label\":\"Commitment\", \"Value\":', CommitmentDiscountSavings, ' }]'))\n | mv-expand json\n | project Label = tostring(json.Label), Value = tolong(json.Value), Period\n);\ndata\n", "id": "f5f240a8-a818-4f27-bdfb-e96fcfe433bd", "usedVariables": ["CostsByDay", "CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsByDay\n| where ChargeCategory == 'Usage'\n| where isnotempty(CommitmentDiscountId)\n//\n| extend x_CommitmentDiscountUtilizationPotential = case(\n ProviderName == 'Microsoft', EffectiveCost,\n CommitmentDiscountCategory == 'Usage', ConsumedQuantity,\n CommitmentDiscountCategory == 'Spend', EffectiveCost,\n real(0)\n)\n| extend x_CommitmentDiscountUtilizationAmount = iff(CommitmentDiscountStatus == 'Used', x_CommitmentDiscountUtilizationPotential, real(0))\n//\n| summarize\n CommitmentDiscountName = take_any(CommitmentDiscountName),\n CommitmentDiscountType = take_any(CommitmentDiscountType),\n x_SkuTerm = take_any(x_SkuTerm),\n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost),\n x_CommitmentDiscountUtilizationAmount = sum(x_CommitmentDiscountUtilizationAmount),\n x_CommitmentDiscountUtilizationPotential = sum(x_CommitmentDiscountUtilizationPotential)\n by\n CommitmentDiscountId\n| order by EffectiveCost desc\n| project\n CommitmentDiscountName,\n CommitmentDiscountType,\n Term = case(isempty(x_SkuTerm) or x_SkuTerm <= 0, '', x_SkuTerm < 12, strcat(x_SkuTerm, ' month', iff(x_SkuTerm != 1, 's', '')), strcat(x_SkuTerm / 12, ' year', iff(x_SkuTerm != 12, 's', ''))),\n Utilization = round(x_CommitmentDiscountUtilizationAmount / x_CommitmentDiscountUtilizationPotential * 100, 1),\n Cost = round(EffectiveCost, 2),\n Savings = round(ListCost - EffectiveCost, 2)\n", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsByDay\n| where ChargeCategory == 'Usage'\n| where isnotempty(CommitmentDiscountId)\n//\n| extend x_CommitmentDiscountUtilizationPotential = case(\n ProviderName == 'Microsoft', EffectiveCost,\n CommitmentDiscountCategory == 'Usage', ConsumedQuantity,\n CommitmentDiscountCategory == 'Spend', EffectiveCost,\n real(0)\n)\n| extend x_CommitmentDiscountUtilizationAmount = iff(CommitmentDiscountStatus == 'Used', x_CommitmentDiscountUtilizationPotential, real(0))\n//\n| summarize\n CommitmentDiscountName = take_any(CommitmentDiscountName),\n CommitmentDiscountType = take_any(CommitmentDiscountType),\n x_SkuTerm = take_any(x_SkuTerm),\n EffectiveCost = sum(EffectiveCost),\n Savings = sum(x_TotalSavings),\n x_CommitmentDiscountUtilizationAmount = sum(x_CommitmentDiscountUtilizationAmount),\n x_CommitmentDiscountUtilizationPotential = sum(x_CommitmentDiscountUtilizationPotential)\n by\n CommitmentDiscountId\n| order by EffectiveCost desc\n| project\n CommitmentDiscountName,\n CommitmentDiscountType,\n Term = case(isempty(x_SkuTerm) or x_SkuTerm <= 0, '', x_SkuTerm < 12, strcat(x_SkuTerm, ' month', iff(x_SkuTerm != 1, 's', '')), strcat(x_SkuTerm / 12, ' year', iff(x_SkuTerm != 12, 's', ''))),\n Utilization = round(x_CommitmentDiscountUtilizationAmount / x_CommitmentDiscountUtilizationPotential * 100, 1),\n Cost = round(EffectiveCost, 2),\n Savings = round(Savings, 2)\n", "id": "d7f31381-ba44-46a1-ad3e-dc6b8826706d", "usedVariables": ["CostsByDay"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost)\n | extend CommitmentDiscountSavings = ContractedCost - EffectiveCost\n | extend NegotiatedDiscountSavings = ListCost - ContractedCost\n | extend TotalSavings = ListCost - EffectiveCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n TotalSavings = sum(x_TotalSavings)\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "e17346d1-0227-4aa4-8765-f9b4bf43bed5", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost)\n | extend CommitmentDiscountSavings = ContractedCost - EffectiveCost\n | extend NegotiatedDiscountSavings = ListCost - ContractedCost\n | extend TotalSavings = ListCost - EffectiveCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n TotalSavings = sum(x_TotalSavings)\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "f1ef29df-7a1d-4dd0-8619-0c0164707b31", "usedVariables": ["CostsByDay"] }, @@ -3113,25 +3113,25 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "CostsByMonth\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost)\n by\n ChargePeriodStart = startofmonth(ChargePeriodStart),\n CommitmentDiscountType\n| project\n ChargePeriodStart,\n Savings = round(ListCost - EffectiveCost, 2),\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", + "text": "CostsByMonth\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n Savings = sum(x_TotalSavings)\n by\n ChargePeriodStart = startofmonth(ChargePeriodStart),\n CommitmentDiscountType\n| project\n ChargePeriodStart,\n Savings = round(Savings, 2),\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", "id": "5bbb5369-ac95-45fc-853c-a6a2ce6a9e7b", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "CostsByMonth\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n Savings = round(sum(ListCost - EffectiveCost), 2)\n by\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", + "text": "CostsByMonth\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n Savings = round(sum(x_TotalSavings), 2)\n by\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", "id": "93f0eb9f-fa4d-4c54-96c2-8c1d3387d13a", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "CostsByDay\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost)\n by\n ChargePeriodStart = startofday(ChargePeriodStart),\n CommitmentDiscountType\n| project\n ChargePeriodStart,\n Savings = round(ListCost - EffectiveCost, 2),\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", + "text": "CostsByDay\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n Savings = sum(x_TotalSavings)\n by\n ChargePeriodStart = startofday(ChargePeriodStart),\n CommitmentDiscountType\n| project\n ChargePeriodStart,\n Savings = round(Savings, 2),\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", "id": "5c442903-65b0-4b53-9e7c-3ea9c1af7be5", "usedVariables": ["CostsByDay"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "CostsByDay\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n Savings = round(sum(ListCost - EffectiveCost), 2)\n by\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", + "text": "CostsByDay\n//\n// Filter out commitment discount purchases\n| where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n//\n| summarize \n Savings = round(sum(x_TotalSavings), 2)\n by\n Type = case(\n isnotempty(CommitmentDiscountType), CommitmentDiscountType,\n 'Negotiated'\n )", "id": "9a9ee4b0-a37d-475f-bf1d-f51573243491", "usedVariables": ["CostsByDay"] }, @@ -3143,7 +3143,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | where ChargeCategory == 'Usage'\n | where isnotempty(CommitmentDiscountId)\n | where EffectiveCost != 0\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost),\n SubAccountName = take_anyif(SubAccountName, isnotempty(SubAccountId)),\n CommitmentDiscountName = take_any(CommitmentDiscountName),\n CommitmentDiscountType = take_any(CommitmentDiscountType)\n by\n ChargePeriodStart,\n SubAccountId,\n CommitmentDiscountId,\n CommitmentDiscountStatus\n | as per\n | union (\n per\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n ContractedCost = sum(ContractedCost),\n ListCost = sum(ListCost),\n SubAccountName = take_anyif(SubAccountName, isnotempty(SubAccountId)),\n CommitmentDiscountName = take_any(CommitmentDiscountName),\n CommitmentDiscountType = take_any(CommitmentDiscountType)\n by\n SubAccountId,\n CommitmentDiscountId,\n CommitmentDiscountStatus\n )\n | order by ChargePeriodStart asc\n | extend BilledCost = todouble(round(BilledCost, 2))\n | extend EffectiveCost = todouble(round(EffectiveCost, 2))\n | extend ContractedCost = todouble(round(ContractedCost, 2))\n | extend ListCost = todouble(round(ListCost, 2))\n | extend CommitmentDiscountSavings = todouble(round(ContractedCost - EffectiveCost, 2))\n | extend NegotiatedDiscountSavings = todouble(round(ListCost - ContractedCost, 2))\n | extend ChargePeriod = iff(isempty(ChargePeriodStart), strcat('Total'), strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)]))\n | extend SubAccountName = iff(isempty(SubAccountName) and CommitmentDiscountStatus == 'Unused', '(Unused)', SubAccountName)\n);\npercent((\n data | evaluate pivot(ChargePeriod, sum(EffectiveCost), SubAccountName, CommitmentDiscountName, CommitmentDiscountType)\n | extend Count = tolong(Total * 1000)\n))\n| project-away Count\n| order by SubAccountName asc, Total desc", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nlet data = (\n CostsByMonth\n | where ChargeCategory == 'Usage'\n | where isnotempty(CommitmentDiscountId)\n | where EffectiveCost != 0\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n SubAccountName = take_anyif(SubAccountName, isnotempty(SubAccountId)),\n CommitmentDiscountName = take_any(CommitmentDiscountName),\n CommitmentDiscountType = take_any(CommitmentDiscountType)\n by\n ChargePeriodStart,\n SubAccountId,\n CommitmentDiscountId,\n CommitmentDiscountStatus\n | as per\n | union (\n per\n | summarize \n BilledCost = sum(BilledCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(NegotiatedDiscountSavings),\n SubAccountName = take_anyif(SubAccountName, isnotempty(SubAccountId)),\n CommitmentDiscountName = take_any(CommitmentDiscountName),\n CommitmentDiscountType = take_any(CommitmentDiscountType)\n by\n SubAccountId,\n CommitmentDiscountId,\n CommitmentDiscountStatus\n )\n | order by ChargePeriodStart asc\n | extend BilledCost = todouble(round(BilledCost, 2))\n | extend EffectiveCost = todouble(round(EffectiveCost, 2))\n | extend CommitmentDiscountSavings = todouble(round(CommitmentDiscountSavings, 2))\n | extend NegotiatedDiscountSavings = todouble(round(NegotiatedDiscountSavings, 2))\n | extend ChargePeriod = iff(isempty(ChargePeriodStart), strcat('Total'), strcat(format_datetime(ChargePeriodStart, 'yyyy-MM - '), monthname[monthofyear(ChargePeriodStart)]))\n | extend SubAccountName = iff(isempty(SubAccountName) and CommitmentDiscountStatus == 'Unused', '(Unused)', SubAccountName)\n);\npercent((\n data | evaluate pivot(ChargePeriod, sum(EffectiveCost), SubAccountName, CommitmentDiscountName, CommitmentDiscountType)\n | extend Count = tolong(Total * 1000)\n))\n| project-away Count\n| order by SubAccountName asc, Total desc", "id": "13cad52d-91e7-4ab4-aad5-4aae21c1019a", "usedVariables": ["CostsByMonth"] }, @@ -3251,19 +3251,19 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost)\n | extend TotalSavings = ListCost - EffectiveCost\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n TotalSavings = sum(x_TotalSavings)\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "e1bc2d51-44af-4dd9-8b0d-a71088b551f5", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "CostsByMonth\n| extend x_AmortizationClass = case(\n ChargeCategory == 'Purchase' and isnotempty(CommitmentDiscountCategory), 'Principal',\n isnotempty(CommitmentDiscountCategory), 'Amortized Charge',\n ''\n)\n| extend x_CommitmentDiscountSavings = iff(ContractedCost == 0, real(0), ContractedCost - EffectiveCost)\n| extend x_NegotiatedDiscountSavings = iff(ListCost == 0, real(0), ListCost - ContractedCost)\n| extend x_TotalSavings = iff(ListCost == 0, real(0), ListCost - EffectiveCost)\n| summarize\n ['List cost'] = round(sumif(ListCost, x_AmortizationClass != 'Principal'), 2),\n ['Effective cost'] = round(sum(EffectiveCost), 2),\n Savings = round(sum(x_TotalSavings), 2)\n by\n Account = x_BillingProfileId,\n Month = substring(startofmonth(ChargePeriodStart), 0, 7)\n| extend ESR = percentstring(Savings/ ['List cost'])\n| order by Month desc", + "text": "CostsByMonth\n| extend x_AmortizationClass = case(\n ChargeCategory == 'Purchase' and isnotempty(CommitmentDiscountCategory), 'Principal',\n isnotempty(CommitmentDiscountCategory), 'Amortized Charge',\n ''\n)\n| summarize\n ['List cost'] = round(sumif(ListCost, x_AmortizationClass != 'Principal'), 2),\n ['Effective cost'] = round(sum(EffectiveCost), 2),\n Savings = round(sum(x_TotalSavings), 2)\n by\n Account = x_BillingProfileId,\n Month = substring(startofmonth(ChargePeriodStart), 0, 7)\n| extend ESR = percentstring(Savings/ ['List cost'])\n| order by Month desc", "id": "3b3f0a58-2d84-4e3e-bebc-3e747a7d5ede", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost)\n | extend TotalSavings = ListCost - EffectiveCost\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n TotalSavings = sum(x_TotalSavings)\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "cb34f22b-9370-460c-9658-3e73d220bbc7", "usedVariables": ["CostsByDay"] }, @@ -3275,7 +3275,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "CostsByMonth\n| extend x_AmortizationClass = case(\n ChargeCategory == 'Purchase' and isnotempty(CommitmentDiscountCategory), 'Principal',\n isnotempty(CommitmentDiscountCategory), 'Amortized Charge',\n ''\n)\n| extend x_CommitmentDiscountSavings = iff(ContractedCost == 0, real(0), ContractedCost - EffectiveCost)\n| extend x_NegotiatedDiscountSavings = iff(ListCost == 0, real(0), ListCost - ContractedCost)\n| extend x_TotalSavings = iff(ListCost == 0, real(0), ListCost - EffectiveCost)\n| summarize\n ['On-demand'] = round(sumif(EffectiveCost, PricingCategory == 'Standard'), 2),\n Spot = round(sumif(EffectiveCost, PricingCategory == 'Dynamic'), 2),\n Reservation = round(sumif(EffectiveCost, CommitmentDiscountType == 'Reservation'), 2),\n ['Savings plan'] = round(sumif(EffectiveCost, CommitmentDiscountType == 'Savings Plan'), 2),\n ['Other'] = round(sumif(EffectiveCost, PricingCategory !in ('Standard', 'Dynamic') and isempty(CommitmentDiscountType)), 2)\n by\n Account = x_BillingProfileId,\n Month = substring(startofmonth(ChargePeriodStart), 0, 7)\n| order by Month desc", + "text": "CostsByMonth\n| extend x_AmortizationClass = case(\n ChargeCategory == 'Purchase' and isnotempty(CommitmentDiscountCategory), 'Principal',\n isnotempty(CommitmentDiscountCategory), 'Amortized Charge',\n ''\n)\n| summarize\n ['On-demand'] = round(sumif(EffectiveCost, PricingCategory == 'Standard'), 2),\n Spot = round(sumif(EffectiveCost, PricingCategory == 'Dynamic'), 2),\n Reservation = round(sumif(EffectiveCost, CommitmentDiscountType == 'Reservation'), 2),\n ['Savings plan'] = round(sumif(EffectiveCost, CommitmentDiscountType == 'Savings Plan'), 2),\n ['Other'] = round(sumif(EffectiveCost, PricingCategory !in ('Standard', 'Dynamic') and isempty(CommitmentDiscountType)), 2)\n by\n Account = x_BillingProfileId,\n Month = substring(startofmonth(ChargePeriodStart), 0, 7)\n| order by Month desc", "id": "0341b3e4-eccc-4924-9555-9835b128c543", "usedVariables": ["CostsByMonth"] }, diff --git a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql index 912b1ff8a..cc943e2b0 100644 --- a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql +++ b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql @@ -114,7 +114,10 @@ Costs_v1_2() ) | extend CommitmentDiscountQuantity = case( isempty(CommitmentDiscountStatus), real(null), - CommitmentDiscountCategory == 'Spend', EffectiveCost / coalesce(x_BillingExchangeRate, real(1)), + // Don't assume a 1:1 exchange rate when it's missing -- that silently distorts + // the derived quantity (and any utilization built on it) by the true FX factor. + // Leave it unset like the other not-derivable cases below instead. + CommitmentDiscountCategory == 'Spend' and isnotempty(x_BillingExchangeRate), EffectiveCost / x_BillingExchangeRate, CommitmentDiscountCategory == 'Usage' and isnotempty(x_CommitmentDiscountNormalizedRatio), PricingQuantity / coalesce(x_PricingBlockSize, real(1)) * x_CommitmentDiscountNormalizedRatio, real(null) ) diff --git a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql index da41cafa4..dc730e1a5 100644 --- a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql +++ b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql @@ -529,7 +529,10 @@ Costs_transform_v1_2() isnotempty(CommitmentDiscountQuantity), CommitmentDiscountQuantity, // FOCUS 1.0-preview, 1.0 isempty(CommitmentDiscountStatus), real(null), - CommitmentDiscountCategory == 'Spend', EffectiveCost / coalesce(x_BillingExchangeRate, real(1)), + // Don't assume a 1:1 exchange rate when it's missing -- that silently distorts + // the derived quantity (and any utilization built on it) by the true FX factor. + // Leave it unset like the other not-derivable cases below instead. + CommitmentDiscountCategory == 'Spend' and isnotempty(x_BillingExchangeRate), EffectiveCost / x_BillingExchangeRate, CommitmentDiscountCategory == 'Usage' and isnotempty(x_CommitmentDiscountNormalizedRatio), PricingQuantity / coalesce(x_PricingBlockSize, real(1)) * x_CommitmentDiscountNormalizedRatio, real(null) ) From 0e05f98b0a211c798167a32ff5e8871e1691c2ad Mon Sep 17 00:00:00 2001 From: Michael Flanakin Date: Thu, 13 Aug 2026 18:33:48 -0700 Subject: [PATCH 2/3] Revert FX-fallback change in CommitmentDiscountQuantity derivation The edited branch is only reached by FOCUS-sourced rows where a null x_BillingExchangeRate means single-currency billing (PricingCurrency == BillingCurrency, so Cost Management doesn't populate a rate) -- not the EA/legacy null-source scenario the change was justified against. Those EA/legacy paths also null CommitmentDiscountQuantity upstream, so they short-circuit at the first case() branch and never reach this one. For single-currency accounts, a rate of 1.0 is correct, not a guess. Requiring isnotempty(x_BillingExchangeRate) instead silently drops these rows (and their CommitmentDiscountUnit) from utilization aggregates -- trading a bounded, visible number for a silent hole in sum()-based denominators. Restoring coalesce(x_BillingExchangeRate, real(1)). Co-Authored-By: Claude Sonnet 5 --- .../Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql | 5 +---- .../Analytics/scripts/IngestionSetup_v1_2.kql | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql index cc943e2b0..912b1ff8a 100644 --- a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql +++ b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/HubSetup_v1_2.kql @@ -114,10 +114,7 @@ Costs_v1_2() ) | extend CommitmentDiscountQuantity = case( isempty(CommitmentDiscountStatus), real(null), - // Don't assume a 1:1 exchange rate when it's missing -- that silently distorts - // the derived quantity (and any utilization built on it) by the true FX factor. - // Leave it unset like the other not-derivable cases below instead. - CommitmentDiscountCategory == 'Spend' and isnotempty(x_BillingExchangeRate), EffectiveCost / x_BillingExchangeRate, + CommitmentDiscountCategory == 'Spend', EffectiveCost / coalesce(x_BillingExchangeRate, real(1)), CommitmentDiscountCategory == 'Usage' and isnotempty(x_CommitmentDiscountNormalizedRatio), PricingQuantity / coalesce(x_PricingBlockSize, real(1)) * x_CommitmentDiscountNormalizedRatio, real(null) ) diff --git a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql index dc730e1a5..da41cafa4 100644 --- a/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql +++ b/src/templates/finops-hub/modules/Microsoft.FinOpsHubs/Analytics/scripts/IngestionSetup_v1_2.kql @@ -529,10 +529,7 @@ Costs_transform_v1_2() isnotempty(CommitmentDiscountQuantity), CommitmentDiscountQuantity, // FOCUS 1.0-preview, 1.0 isempty(CommitmentDiscountStatus), real(null), - // Don't assume a 1:1 exchange rate when it's missing -- that silently distorts - // the derived quantity (and any utilization built on it) by the true FX factor. - // Leave it unset like the other not-derivable cases below instead. - CommitmentDiscountCategory == 'Spend' and isnotempty(x_BillingExchangeRate), EffectiveCost / x_BillingExchangeRate, + CommitmentDiscountCategory == 'Spend', EffectiveCost / coalesce(x_BillingExchangeRate, real(1)), CommitmentDiscountCategory == 'Usage' and isnotempty(x_CommitmentDiscountNormalizedRatio), PricingQuantity / coalesce(x_PricingBlockSize, real(1)) * x_CommitmentDiscountNormalizedRatio, real(null) ) From 00f51dd038c243bd2b40b486593891e4187d55cc Mon Sep 17 00:00:00 2001 From: Michael Flanakin Date: Wed, 26 Aug 2026 12:19:26 -0700 Subject: [PATCH 3/3] fix(hubs): reconcile displayed operands with clamped savings on 6 dashboard tiles Roland Krummenacher and MSBrett both flagged that summing clamped, row-level savings columns (x_TotalSavings, x_CommitmentDiscountSavings, x_NegotiatedDiscountSavings) for the result side of 6 tiles, while leaving ListCost/ContractedCost/EffectiveCost as raw aggregates on the operand side, broke the on-screen equations those tiles visually promise (e.g. "List - Contracted = Negotiated savings"). Clamping doesn't distribute over sums, so the two sides no longer reconciled. Rather than reverting to raw subtraction (which would silently reintroduce the original per-row clamping bug for just these tiles), derive the displayed List/Contracted cost operands from the same clamped basis as the results, anchored on EffectiveCost (the only value that's never negative-clamped): ContractedCost' = EffectiveCost + sum(x_CommitmentDiscountSavings) ListCost' = ContractedCost' + sum(x_NegotiatedDiscountSavings) TotalSavings' = sum(x_NegotiatedDiscountSavings) + sum(x_CommitmentDiscountSavings) Applied to: - Savings breakdown waterfall, monthly (e17346d1) and daily (f1ef29df) - Total/Negotiated/Commitment savings bar (f5f240a8) - Cost + savings stacked area chart (dcc1f533) - already reconciled by construction; added a clarifying comment only - Effective Savings Rate, monthly (e1bc2d51) and daily (cb34f22b) This changes the ESR definition on the two ESR tiles, since TotalSavings and ListCost are now derived consistently rather than mixing a clamped numerator with a raw denominator. Added a release note under FinOps hubs v15 in docs-mslearn/toolkit/changelog.md per review feedback. Verified against the counterexample from review: rows (List, Contracted, Effective) = (100,120,80) and (100,80,60) give NegotiatedDiscountSavings=20, CommitmentDiscountSavings=60, Effective=140 -> ContractedCost'=200 -> ListCost'=220; all displayed equations hold exactly. The other ~15 tiles' clamped-sum fix from the original PR is unaffected. Co-Authored-By: Claude Sonnet 5 --- docs-mslearn/toolkit/changelog.md | 3 ++- src/templates/finops-hub/dashboard.json | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs-mslearn/toolkit/changelog.md b/docs-mslearn/toolkit/changelog.md index 8849f945f..3df45dcc4 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: 08/12/2026 +ms.date: 08/26/2026 ms.topic: reference ms.service: finops ms.subservice: finops-toolkit @@ -95,6 +95,7 @@ _Released June 2026_ - **Changed** - Added a callout to the `config_RunBackfillJob` backfill option clarifying that it isn't supported on Microsoft Customer Agreement (MCA) billing accounts or billing profiles ([#2113](https://github.com/microsoft/finops-toolkit/issues/2113)). + - Changed the Data Explorer dashboard's savings-breakdown, stacked cost + savings, and Effective Savings Rate tiles to derive their displayed List cost and Contracted cost operands from the same clamped, row-level savings basis as the results shown alongside them, so the on-screen equations (for example, "List − Contracted = Negotiated savings") always reconcile. This changes the Effective Savings Rate definition on the affected tiles from `(sum(ListCost) − sum(EffectiveCost)) / sum(ListCost)` to a derived List cost built from Effective cost plus the clamped Negotiated and Commitment savings sums ([#2093](https://github.com/microsoft/finops-toolkit/issues/2093)). - **Fixed** - Fixed Data Factory ingestion memory pressure during emptiness filtering. - Replaced `isnotempty(strcat(x_SkuMeterId, x_SkuOfferId))` with separate `isnotempty()` checks in FinOps hub ingestion scripts to avoid temporary string allocation. diff --git a/src/templates/finops-hub/dashboard.json b/src/templates/finops-hub/dashboard.json index 93e43b961..119d422cc 100644 --- a/src/templates/finops-hub/dashboard.json +++ b/src/templates/finops-hub/dashboard.json @@ -2873,7 +2873,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\nCostsPlus\n| where startofmonth(ChargePeriodStart) >= startofmonth(now(), -1)\n| summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n by\n ChargePeriodStart,\n Month = strcat(format_datetime(ChargePeriodStart, 'MM '), monthname[monthofyear(ChargePeriodStart)])\n| order by ChargePeriodStart asc\n| extend EffectiveCostRunningTotal = row_cumsum(EffectiveCost, prev(Month) != Month)\n| extend CommitmentDiscountSavingsRunningTotal = row_cumsum(CommitmentDiscountSavings, prev(Month) != Month)\n| extend NegotiatedDiscountSavingsRunningTotal = row_cumsum(NegotiatedDiscountSavings, prev(Month) != Month)\n| project ChargePeriodStart, CommitmentDiscountSavingsRunningTotal, NegotiatedDiscountSavingsRunningTotal, EffectiveCostRunningTotal, Month\n| render areachart ", + "text": "let monthname = dynamic(['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);\n//\n// Stacked area: EffectiveCost is the unclamped base layer; CommitmentDiscountSavings and\n// NegotiatedDiscountSavings are clamped, row-level sums layered on top. The stack top\n// (Effective + Commitment + Negotiated) is therefore a derived 'cost without discounts'\n// figure built on the same clamped basis as the savings layers -- it reconciles with this\n// chart's own layers by construction, but will not always equal the raw sum(ListCost) KPI\n// shown elsewhere on the page. See the savings-breakdown tiles for the same derivation.\n//\nCostsPlus\n| where startofmonth(ChargePeriodStart) >= startofmonth(now(), -1)\n| summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n by\n ChargePeriodStart,\n Month = strcat(format_datetime(ChargePeriodStart, 'MM '), monthname[monthofyear(ChargePeriodStart)])\n| order by ChargePeriodStart asc\n| extend EffectiveCostRunningTotal = row_cumsum(EffectiveCost, prev(Month) != Month)\n| extend CommitmentDiscountSavingsRunningTotal = row_cumsum(CommitmentDiscountSavings, prev(Month) != Month)\n| extend NegotiatedDiscountSavingsRunningTotal = row_cumsum(NegotiatedDiscountSavings, prev(Month) != Month)\n| project ChargePeriodStart, CommitmentDiscountSavingsRunningTotal, NegotiatedDiscountSavingsRunningTotal, EffectiveCostRunningTotal, Month\n| render areachart ", "id": "dcc1f533-e5f9-4855-9e4c-21e21fcdf943", "usedVariables": ["CostsPlus"] }, @@ -3071,7 +3071,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByMonth | extend Period = 'Last n months'\n | union (CostsByDay | extend Period = 'Last n days')\n | summarize\n TotalSavings = round(sum(x_TotalSavings), 2),\n NegotiatedDiscountSavings = round(sum(x_NegotiatedDiscountSavings), 2),\n CommitmentDiscountSavings = round(sum(x_CommitmentDiscountSavings), 2)\n by\n Period\n | project Period, json = todynamic(strcat('[{ \"Label\":\"Total\", \"Value\":', TotalSavings, ' }, { \"Label\":\"Negotiated\", \"Value\":', NegotiatedDiscountSavings, ' }, { \"Label\":\"Commitment\", \"Value\":', CommitmentDiscountSavings, ' }]'))\n | mv-expand json\n | project Label = tostring(json.Label), Value = tolong(json.Value), Period\n);\ndata\n", + "text": "let data = materialize(\n CostsByMonth | extend Period = 'Last n months'\n | union (CostsByDay | extend Period = 'Last n days')\n | summarize\n NegotiatedDiscountSavings = round(sum(x_NegotiatedDiscountSavings), 2),\n CommitmentDiscountSavings = round(sum(x_CommitmentDiscountSavings), 2)\n by\n Period\n //\n // Total savings is derived as the sum of the two clamped components (not the\n // independently row-clamped x_TotalSavings) so the Total bar always reconciles\n // with Negotiated + Commitment shown alongside it.\n | extend TotalSavings = NegotiatedDiscountSavings + CommitmentDiscountSavings\n | project Period, json = todynamic(strcat('[{ \"Label\":\"Total\", \"Value\":', TotalSavings, ' }, { \"Label\":\"Negotiated\", \"Value\":', NegotiatedDiscountSavings, ' }, { \"Label\":\"Commitment\", \"Value\":', CommitmentDiscountSavings, ' }]'))\n | mv-expand json\n | project Label = tostring(json.Label), Value = tolong(json.Value), Period\n);\ndata\n", "id": "f5f240a8-a818-4f27-bdfb-e96fcfe433bd", "usedVariables": ["CostsByDay", "CostsByMonth"] }, @@ -3083,13 +3083,13 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n TotalSavings = sum(x_TotalSavings)\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n //\n // Derive displayed cost operands from the same clamped, row-level savings basis as the\n // results so the on-screen equations reconcile (List - Contracted = Negotiated savings,\n // Contracted - Effective = Commitment savings). EffectiveCost is the only unclamped value;\n // Contracted and List are built up from it so both sides of each equation match exactly.\n | extend ContractedCost = EffectiveCost + CommitmentDiscountSavings\n | extend ListCost = ContractedCost + NegotiatedDiscountSavings\n | extend TotalSavings = NegotiatedDiscountSavings + CommitmentDiscountSavings\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "e17346d1-0227-4aa4-8765-f9b4bf43bed5", "usedVariables": ["CostsByMonth"] }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n //\n | summarize \n ListCost = sum(ListCost),\n ContractedCost = sum(ContractedCost),\n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings),\n TotalSavings = sum(x_TotalSavings)\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where ChargeCategory == 'Usage' or isempty(CommitmentDiscountId)\n //\n | summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n //\n // Derive displayed cost operands from the same clamped, row-level savings basis as the\n // results so the on-screen equations reconcile (List - Contracted = Negotiated savings,\n // Contracted - Effective = Commitment savings). EffectiveCost is the only unclamped value;\n // Contracted and List are built up from it so both sides of each equation match exactly.\n | extend ContractedCost = EffectiveCost + CommitmentDiscountSavings\n | extend ListCost = ContractedCost + NegotiatedDiscountSavings\n | extend TotalSavings = NegotiatedDiscountSavings + CommitmentDiscountSavings\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":13, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"PartialSavings\", \"label\":\"Negotiated savings\", \"value\":\"', numberstring(round(NegotiatedDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":21, \"type\":\"Contracted\", \"label\":\"After negotiated discounts\", \"value\":\"', numberstring(round(ContractedCost, 2)), '\" },',\n '{ \"order\":22, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":23, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":24, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":25, \"type\":\"PartialSavings\", \"label\":\"Commitment savings\", \"value\":\"', numberstring(round(CommitmentDiscountSavings, 2)), '\" },',\n //\n '{ \"order\":31, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":32, \"type\":\"\", \"label\":\"\", \"value\":\"➖\" },',\n '{ \"order\":33, \"type\":\"Effective\", \"label\":\"After commitment discounts\", \"value\":\"', numberstring(round(EffectiveCost, 2)), '\" },',\n '{ \"order\":34, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":35, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "f1ef29df-7a1d-4dd0-8619-0c0164707b31", "usedVariables": ["CostsByDay"] }, @@ -3251,7 +3251,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n TotalSavings = sum(x_TotalSavings)\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByMonth\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n //\n // Derive List cost and Total savings from the same clamped, row-level basis used across\n // the other savings tiles so Total savings / List cost = Effective savings rate reconciles\n // on screen. EffectiveCost is the only unclamped value; Total savings is the sum of the two\n // clamped components, and List cost is built up from Effective + Total savings.\n | extend TotalSavings = NegotiatedDiscountSavings + CommitmentDiscountSavings\n | extend ListCost = EffectiveCost + TotalSavings\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "e1bc2d51-44af-4dd9-8b0d-a71088b551f5", "usedVariables": ["CostsByMonth"] }, @@ -3263,7 +3263,7 @@ }, { "dataSource": { "kind": "inline", "dataSourceId": "23540be2-ffc9-4b61-8c4c-05e493e682a6" }, - "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n ListCost = sum(ListCost),\n TotalSavings = sum(x_TotalSavings)\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", + "text": "let data = materialize(\n CostsByDay\n //\n // Don't double-count commitment discount purchases\n | where x_AmortizationClass != 'Principal'\n //\n | summarize \n EffectiveCost = sum(EffectiveCost),\n CommitmentDiscountSavings = sum(x_CommitmentDiscountSavings),\n NegotiatedDiscountSavings = sum(x_NegotiatedDiscountSavings)\n //\n // Derive List cost and Total savings from the same clamped, row-level basis used across\n // the other savings tiles so Total savings / List cost = Effective savings rate reconciles\n // on screen. EffectiveCost is the only unclamped value; Total savings is the sum of the two\n // clamped components, and List cost is built up from Effective + Total savings.\n | extend TotalSavings = NegotiatedDiscountSavings + CommitmentDiscountSavings\n | extend ListCost = EffectiveCost + TotalSavings\n | extend EffectiveSavingsRate = TotalSavings / ListCost\n | project json = todynamic(strcat('[',\n '{ \"order\":11, \"type\":\"TotalSavings\", \"label\":\"Total savings\", \"value\":\"', numberstring(round(TotalSavings, 2)), '\" },',\n '{ \"order\":12, \"type\":\"\", \"label\":\"\", \"value\":\"➗\" },',\n '{ \"order\":13, \"type\":\"List\", \"label\":\"Cost without discounts\", \"value\":\"', numberstring(round(ListCost, 2)), '\" },',\n '{ \"order\":14, \"type\":\"\", \"label\":\"\", \"value\":\"🟰\" },',\n '{ \"order\":15, \"type\":\"EffectiveSavingsRate\", \"label\":\"Effective savings rate\", \"value\":\"', percentstring(EffectiveSavingsRate), '\" }',\n ']'))\n | mv-expand json\n | order by toint(json.order) asc\n | project Label = tostring(json.label), Value = tostring(json.value), Type = tostring(json.type)\n);\ndata", "id": "cb34f22b-9370-460c-9658-3e73d220bbc7", "usedVariables": ["CostsByDay"] },