<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Requesting help with Dax Calculation in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086807#M41316</link>
    <description>&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;I have matrix&amp;nbsp; that looks like this (See image 1):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vmurali1_1-1676850638697.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/874217i5F56369B064124A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vmurali1_1-1676850638697.png" alt="vmurali1_1-1676850638697.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the rows we have the service name. In the columns we have locations, and the value field is "Product Cost per Case" (Here is how I created this measure)&lt;/P&gt;&lt;P&gt;Product cost = Sum (item price)&lt;/P&gt;&lt;P&gt;Total # of cases = distinctcount (Case#)&lt;/P&gt;&lt;P&gt;Product cpc = Product cost/total# of cases&lt;/P&gt;&lt;P&gt;Now, here is what I am looking for:&lt;/P&gt;&lt;P&gt;In each value field, I want to show the opportunity cost instead of a product cost per case.&lt;/P&gt;&lt;P&gt;Opportunity cost = (Total CPC value – product CPC of that specific field/location) * Total # of cases for that specific field/location&lt;/P&gt;&lt;P&gt;Let’s take orthopedics, MI as an example&lt;/P&gt;&lt;P&gt;Opportunity cost = (36000-22500) *1&lt;/P&gt;&lt;P&gt;Can someone please assist me how to do the above calculation as a measure or any other means ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please see image 2 for the data structure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vmurali1_2-1676850659533.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/874218i42B5DFB3784E1931/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vmurali1_2-1676850659533.png" alt="vmurali1_2-1676850659533.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreiate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Feb 2023 23:53:10 GMT</pubDate>
    <dc:creator>vmurali1</dc:creator>
    <dc:date>2023-02-19T23:53:10Z</dc:date>
    <item>
      <title>Requesting help with Dax Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086807#M41316</link>
      <description>&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;I have matrix&amp;nbsp; that looks like this (See image 1):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vmurali1_1-1676850638697.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/874217i5F56369B064124A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vmurali1_1-1676850638697.png" alt="vmurali1_1-1676850638697.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the rows we have the service name. In the columns we have locations, and the value field is "Product Cost per Case" (Here is how I created this measure)&lt;/P&gt;&lt;P&gt;Product cost = Sum (item price)&lt;/P&gt;&lt;P&gt;Total # of cases = distinctcount (Case#)&lt;/P&gt;&lt;P&gt;Product cpc = Product cost/total# of cases&lt;/P&gt;&lt;P&gt;Now, here is what I am looking for:&lt;/P&gt;&lt;P&gt;In each value field, I want to show the opportunity cost instead of a product cost per case.&lt;/P&gt;&lt;P&gt;Opportunity cost = (Total CPC value – product CPC of that specific field/location) * Total # of cases for that specific field/location&lt;/P&gt;&lt;P&gt;Let’s take orthopedics, MI as an example&lt;/P&gt;&lt;P&gt;Opportunity cost = (36000-22500) *1&lt;/P&gt;&lt;P&gt;Can someone please assist me how to do the above calculation as a measure or any other means ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please see image 2 for the data structure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vmurali1_2-1676850659533.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/874218i42B5DFB3784E1931/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vmurali1_2-1676850659533.png" alt="vmurali1_2-1676850659533.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreiate your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 23:53:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086807#M41316</guid>
      <dc:creator>vmurali1</dc:creator>
      <dc:date>2023-02-19T23:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting help with Dax Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086844#M41318</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/418694"&gt;@vmurali1&lt;/a&gt;&amp;nbsp;Maybe:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Opportunity Cost =
  VAR __Service = MAX('Table'[Service name])
  VAR __Total = SUMX(FILTER(ALL('Table'),[Service name] = __Service),[Item price])
  VAR __LocationTotal = SUM('Table'[Item price])
  VAR __Result = (__Total - __LocationTotal) * 1
RETURN
  __Result&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Feb 2023 00:44:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086844#M41318</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-02-20T00:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting help with Dax Calculation</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086927#M41320</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;BR /&gt;Thank you for your response. It did not work. The "*1" is nothing but the # of cases so, i went ahead and replaced that with the # of cases measure that i already have and it still shows error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 01:52:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Requesting-help-with-Dax-Calculation/m-p/3086927#M41320</guid>
      <dc:creator>vmurali1</dc:creator>
      <dc:date>2023-02-20T01:52:11Z</dc:date>
    </item>
  </channel>
</rss>

