<?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: DAX calculation weighted average per category in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculation-weighted-average-per-category/m-p/3004856#M101613</link>
    <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318146" data-lia-user-login="ilyav" class="lia-mention lia-mention-user"&gt;ilyav&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;I'd like to suggest you add values function with your category field in the formula and it will auto filter these calculation ranges with current category values.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;formula =
CALCULATE (
    CALCULATE ( SUM ( 'Table'[Sales] ), VALUES ( 'Table'[Category] ) )
        / SUM ( 'Table'[Sales] ),
    ALLSELECTED ( 'Table' )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jan 2023 03:21:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-01-06T03:21:25Z</dc:date>
    <item>
      <title>DAX calculation weighted average per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculation-weighted-average-per-category/m-p/3002717#M101440</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help with calculating a weighed average and was not able to find a solution for my use case and would appreaciate any help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calculate a margin weighed average per category, here is an example of the data;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Category, order, total line sale and margin are given in my dataset and I can calculate the weight = Total line Sale / SUM of all total line sales and Weighed margin = Weight x margin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem that I am having now is that I want to create a visual showing the weighted average per category. So the weight column needs to dynamically adjust based on the groupping of the category, meaning that if I want to show 'category a' the 2 lines of the 'weight' need to sum up to 100% and then same for 'category b'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my example the correct output should be:&lt;/P&gt;&lt;P&gt;Category a weighted average = 39%&amp;nbsp;&lt;/P&gt;&lt;P&gt;Category b weighted average = 51%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to DAX it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for all any help or pointers!&lt;/P&gt;&lt;P&gt;Ilya&lt;/P&gt;&lt;P&gt;Then I need&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 08:19:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculation-weighted-average-per-category/m-p/3002717#M101440</guid>
      <dc:creator>ilyav</dc:creator>
      <dc:date>2023-01-05T08:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: DAX calculation weighted average per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculation-weighted-average-per-category/m-p/3004856#M101613</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318146" data-lia-user-login="ilyav" class="lia-mention lia-mention-user"&gt;ilyav&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;I'd like to suggest you add values function with your category field in the formula and it will auto filter these calculation ranges with current category values.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;formula =
CALCULATE (
    CALCULATE ( SUM ( 'Table'[Sales] ), VALUES ( 'Table'[Category] ) )
        / SUM ( 'Table'[Sales] ),
    ALLSELECTED ( 'Table' )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 03:21:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculation-weighted-average-per-category/m-p/3004856#M101613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-06T03:21:25Z</dc:date>
    </item>
  </channel>
</rss>

