<?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 Re: Calculate weighted average based on another field in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4125634#M163835</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403328" data-lia-user-login="SrinivasK" class="lia-mention lia-mention-user"&gt;SrinivasK&lt;/a&gt;&amp;nbsp;, try this measure below, and if you encounter any issues, let me know.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Weighted Avg = 
VAR TotalVol = CALCULATE(SUM(Table[Vol]), ALL(Table))
RETURN
SUMX(
    Table,
    DIVIDE(Table[Vol], TotalVol) * Table[Budget]
)&lt;/LI-CODE&gt;&lt;P align="center"&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Did I answer your question?&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;If so, please mark my post as the solution! &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Your Kudos are much appreciated!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Proud to be a Solution Supplier!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Aug 2024 19:53:03 GMT</pubDate>
    <dc:creator>ahadkarimi</dc:creator>
    <dc:date>2024-08-29T19:53:03Z</dc:date>
    <item>
      <title>Calculate weighted average based on another field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4125631#M163834</link>
      <description>&lt;P&gt;I have product wise volume and certain budget allocated on it but need to find prorpotion of this budget by calculating share of volume in total volume.&lt;/P&gt;&lt;P&gt;I tried few variations of this - using Allselected or All because there were few filters working on this visual matrix table. But unable to get the result shown in weighted average column below. Can any expert help ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Weighted Avg =&amp;nbsp;&lt;/P&gt;&lt;P&gt;var totalvol = calculate(sum(table[Vol]),All (table)),&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;Sumx(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;All (table),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Divide ((table[Vol]),&amp;nbsp;totalvol) * (table[Budget]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Vol&lt;/TD&gt;&lt;TD&gt;Budget&lt;/TD&gt;&lt;TD&gt;Weighted Avg (Result)&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;12.5 ((200/800)*50)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;12.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;800&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 29 Aug 2024 19:51:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4125631#M163834</guid>
      <dc:creator>SrinivasK</dc:creator>
      <dc:date>2024-08-29T19:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate weighted average based on another field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4125634#M163835</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403328" data-lia-user-login="SrinivasK" class="lia-mention lia-mention-user"&gt;SrinivasK&lt;/a&gt;&amp;nbsp;, try this measure below, and if you encounter any issues, let me know.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Weighted Avg = 
VAR TotalVol = CALCULATE(SUM(Table[Vol]), ALL(Table))
RETURN
SUMX(
    Table,
    DIVIDE(Table[Vol], TotalVol) * Table[Budget]
)&lt;/LI-CODE&gt;&lt;P align="center"&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Did I answer your question?&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;If so, please mark my post as the solution! &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva"&gt;&lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Your Kudos are much appreciated!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;Proud to be a Solution Supplier!&lt;/STRONG&gt;&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 19:53:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4125634#M163835</guid>
      <dc:creator>ahadkarimi</dc:creator>
      <dc:date>2024-08-29T19:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate weighted average based on another field</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4126286#M163861</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="785426" data-lia-user-login="ahadkarimi" class="lia-mention lia-mention-user"&gt;ahadkarimi&lt;/a&gt;&amp;nbsp;for your answer. I changed All to Allselected on Total var and it worked. I guess since there are filters applied, on the matrix, the allselected worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 05:42:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-weighted-average-based-on-another-field/m-p/4126286#M163861</guid>
      <dc:creator>SrinivasK</dc:creator>
      <dc:date>2024-08-30T05:42:07Z</dc:date>
    </item>
  </channel>
</rss>

