{"id":405,"date":"2024-05-24T09:08:09","date_gmt":"2024-05-24T09:08:09","guid":{"rendered":"https:\/\/datadandies.nl\/?p=405"},"modified":"2024-05-31T07:52:28","modified_gmt":"2024-05-31T07:52:28","slug":"what-to-do-when-you-measure-totals-are-incorrect-in-power-bi","status":"publish","type":"post","link":"https:\/\/datadandies.nl\/index.php\/2024\/05\/24\/what-to-do-when-you-measure-totals-are-incorrect-in-power-bi\/","title":{"rendered":"What to do when your measure totals are incorrect in Power BI (Budget VS Actuals with a partly missing budget)"},"content":{"rendered":"\n<p>Imagine you want to compare budget VS actuals but the budget is incomplete. There is a limited amount of time, so completing the budget manually is not an option. We\u2019ll use actuals wherever budget amounts are missing.<\/p>\n\n\n\n<p>So far so good. But wait a second&#8230; what is that? The Power BI Measure Totals are incorrect &#8230;!<\/p>\n\n\n\n<p>Recently I came across this scenario and I wanted to share a possible solution for this problem. The detailed scenario can be found in the blog post below.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Scenario: a call center that budgetted a certain amount of minutes for every line, but did NOT budget a certain amount of calls for every line. The goal of management is to compare the average handling time (defined as TotalMinutes \/ TotalCalls) with the budgetted handling time, but that proves difficult with a budget that is incomplete. There is no time to enter new values for the budgetted total calls because management wants to analyze right NOW. They tell the resident Data Analyst to the use real total calls instead of the budgetted total calls whenever the budgetted total calls is missing. Time to roll up our sleeves&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"589\" src=\"https:\/\/datadandies.nl\/wp-content\/uploads\/2024\/05\/20240531-Call-center-compare-handling-time-incorrect-totals-1024x589.png\" alt=\"\" class=\"wp-image-406\" srcset=\"https:\/\/datadandies.nl\/wp-content\/uploads\/2024\/05\/20240531-Call-center-compare-handling-time-incorrect-totals-1024x589.png 1024w, https:\/\/datadandies.nl\/wp-content\/uploads\/2024\/05\/20240531-Call-center-compare-handling-time-incorrect-totals-300x173.png 300w, https:\/\/datadandies.nl\/wp-content\/uploads\/2024\/05\/20240531-Call-center-compare-handling-time-incorrect-totals-768x442.png 768w, https:\/\/datadandies.nl\/wp-content\/uploads\/2024\/05\/20240531-Call-center-compare-handling-time-incorrect-totals-1536x884.png 1536w, https:\/\/datadandies.nl\/wp-content\/uploads\/2024\/05\/20240531-Call-center-compare-handling-time-incorrect-totals-2048x1179.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"AvgHandlingTimeBudget NEW CorrectTotal = \n\/\/ Scenario: a call center that budgetted a certain amount of minutes for every line, but did NOT budget a certain amount of calls for every line. The goal of management is to compare the average handling time (defined as TotalMinutes \/ TotalCalls) with the budgetted handling time, but that proves difficult with a budget that is incomplete. There is no time to enter new values for the budgetted total calls because management wants to analyze right NOW. They tell the resident Data Analyst to the use real total calls instead of the budgetted total calls whenever the budgetted total calls is missing. Time to roll up our sleeves...\nVAR _ResultRows = \n    SWITCH(\n        TRUE(),\n        ISBLANK(SUM('Table'[TotalCallsBudget])), 550,   \/\/ If total calls budget is empty, then use 550 calls as the budgetted amount of calls for this line\n        [AvgHandlingTimeBudget]                         \/\/ If total calls budget is NOT empty, then divide the budgetted total minutes by the budgetted total minutes\n    )                                                   \/\/ Done! ... Or are we? The amount on the total row is incorrect! Greg Deckler grumbling intensifies! \n\nVAR _TableTotal =                                       \/\/ Create a table in order to calculate a new budgetted total calls amount\n\tADDCOLUMNS(\n\t\t'Table',\n\t\t&quot;TotalCallsBudgetNEW&quot;, DIVIDE('Table'[TotalMinutesBudget], [AvgHandlingTimeBudget NEW WrongTotal]) \/\/ We can get the total amount of calls by dividing the total minutes by the new average handling time\n\t)\n\nVAR _ResultTotalRow = \n    DIVIDE(\n        SUMX(_TableTotal, [TotalMinutesBudget]),        \/\/ The total amount of budgetted minutes were already present so we use this as the numerator \n        SUMX(_TableTotal, [TotalCallsBudgetNEW])        \/\/ Our newly created budgetted total calls is here to act as the denominator\n        )\n\nVAR _Result = \/\/ All set.\n    IF(\n        ISINSCOPE('Table'[Line]),                       \/\/ If if it not the total row...\n        _ResultRows,                                    \/\/ ... Use the results from the variable _ResultRows\n        _ResultTotalRow                                 \/\/ ... Otherwise use the results from the variable _ResultTotalRow!\n    )\n    \nRETURN\n_Result\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Kopieer\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">AvgHandlingTimeBudget<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">NEW<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">CorrectTotal<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\">\/\/ Scenario: a call center that budgetted a certain amount of minutes for every line, but did NOT budget a certain amount of calls for every line. The goal of management is to compare the average handling time (defined as TotalMinutes \/ TotalCalls) with the budgetted handling time, but that proves difficult with a budget that is incomplete. There is no time to enter new values for the budgetted total calls because management wants to analyze right NOW. They tell the resident Data Analyst to the use real total calls instead of the budgetted total calls whenever the budgetted total calls is missing. Time to roll up our sleeves...<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">VAR<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">_ResultRows<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">SWITCH<\/span><span style=\"color: #D8DEE9FF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">TRUE<\/span><span style=\"color: #D8DEE9FF\">(),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">ISBLANK<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">SUM<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">&#39;Table&#39;<\/span><span style=\"color: #88C0D0\">[TotalCallsBudget]<\/span><span style=\"color: #D8DEE9FF\">)), <\/span><span style=\"color: #B48EAD\">550<\/span><span style=\"color: #D8DEE9FF\">,   <\/span><span style=\"color: #616E88\">\/\/ If total calls budget is empty, then use 550 calls as the budgetted amount of calls for this line<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">[AvgHandlingTimeBudget]<\/span><span style=\"color: #D8DEE9FF\">                         <\/span><span style=\"color: #616E88\">\/\/ If total calls budget is NOT empty, then divide the budgetted total minutes by the budgetted total minutes<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    )                                                   <\/span><span style=\"color: #616E88\">\/\/ Done! ... Or are we? The amount on the total row is incorrect! Greg Deckler grumbling intensifies! <\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">VAR<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">_TableTotal<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">                                       <\/span><span style=\"color: #616E88\">\/\/ Create a table in order to calculate a new budgetted total calls amount<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t<\/span><span style=\"color: #81A1C1\">ADDCOLUMNS<\/span><span style=\"color: #D8DEE9FF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t<\/span><span style=\"color: #8FBCBB\">&#39;Table&#39;<\/span><span style=\"color: #D8DEE9FF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t\t<\/span><span style=\"color: #A3BE8C\">&quot;TotalCallsBudgetNEW&quot;<\/span><span style=\"color: #D8DEE9FF\">, <\/span><span style=\"color: #81A1C1\">DIVIDE<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">&#39;Table&#39;<\/span><span style=\"color: #88C0D0\">[TotalMinutesBudget]<\/span><span style=\"color: #D8DEE9FF\">, <\/span><span style=\"color: #88C0D0\">[AvgHandlingTimeBudget NEW WrongTotal]<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #616E88\">\/\/ We can get the total amount of calls by dividing the total minutes by the new average handling time<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">\t)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">VAR<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">_ResultTotalRow<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">DIVIDE<\/span><span style=\"color: #D8DEE9FF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">SUMX<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">_TableTotal<\/span><span style=\"color: #D8DEE9FF\">, <\/span><span style=\"color: #88C0D0\">[TotalMinutesBudget]<\/span><span style=\"color: #D8DEE9FF\">),        <\/span><span style=\"color: #616E88\">\/\/ The total amount of budgetted minutes were already present so we use this as the numerator <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">SUMX<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">_TableTotal<\/span><span style=\"color: #D8DEE9FF\">, <\/span><span style=\"color: #88C0D0\">[TotalCallsBudgetNEW]<\/span><span style=\"color: #D8DEE9FF\">)        <\/span><span style=\"color: #616E88\">\/\/ Our newly created budgetted total calls is here to act as the denominator<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        )<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">VAR<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">_Result<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ All set.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">IF<\/span><span style=\"color: #D8DEE9FF\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">ISINSCOPE<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #8FBCBB\">&#39;Table&#39;<\/span><span style=\"color: #88C0D0\">[Line]<\/span><span style=\"color: #D8DEE9FF\">),                       <\/span><span style=\"color: #616E88\">\/\/ If if it not the total row...<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">_ResultRows<\/span><span style=\"color: #D8DEE9FF\">,                                    <\/span><span style=\"color: #616E88\">\/\/ ... Use the results from the variable _ResultRows<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">_ResultTotalRow<\/span><span style=\"color: #D8DEE9FF\">                                 <\/span><span style=\"color: #616E88\">\/\/ ... Otherwise use the results from the variable _ResultTotalRow!<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    )<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">RETURN<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">_Result<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Imagine you want to compare budget VS actuals but the budget is incomplete. There is a limited amount of time, so completing the budget manually is not an option. We\u2019ll use actuals wherever budget amounts are missing. So far so good. But wait a second&#8230; what is that? The Power BI Measure Totals are incorrect&hellip;<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/datadandies.nl\/index.php\/2024\/05\/24\/what-to-do-when-you-measure-totals-are-incorrect-in-power-bi\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-405","post","type-post","status-publish","format-standard","hentry","category-blog","tag-powerbi"],"_links":{"self":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/comments?post=405"}],"version-history":[{"count":4,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":410,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/405\/revisions\/410"}],"wp:attachment":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}