<?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: Weighted average of the only the products that appear in ALL selected columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4694482#M179785</link>
    <description>&lt;P&gt;You can try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Weighted Average =
VAR Companies =
    CALCULATETABLE (
        VALUES ( 'Example Data'[Competitor] ),
        ALLSELECTED ( 'Example Data'[Competitor] )
    )
VAR NumCompanies =
    COUNTROWS ( Companies )
VAR CompaniesAndProducts =
    GENERATE ( Companies, CALCULATETABLE ( VALUES ( 'Example Data'[Product ID] ) ) )
VAR ProductsAndNumCompanies =
    GROUPBY (
        CompaniesAndProducts,
        'Example Data'[Product ID],
        "@num", SUMX ( CURRENTGROUP (), 1 )
    )
VAR ProductsInAll =
    FILTER ( ProductsAndNumCompanies, [@num] = NumCompanies )
VAR Result =
    CALCULATE (
        SUMX ( 'Example Data', 'Example Data'[Price] * 'Example Data'[Units] )
            / SUM ( 'Example Data'[Units] ),
        KEEPFILTERS ( ProductsInAll )
    )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 15 May 2025 13:48:00 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2025-05-15T13:48:00Z</dc:date>
    <item>
      <title>Weighted average of the only the products that appear in ALL selected columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4694365#M179778</link>
      <description>&lt;P&gt;I have a mock dataset that contains sales data from 4 different companies (OWN COMPANY, competitor 1-3). I already created a few measures, including the weighted average price:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Weighted AVG Price =&lt;/SPAN&gt; &lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Example Data'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Example Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Price]&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;'Example Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Units]&lt;/SPAN&gt;&lt;SPAN&gt;) / &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Example Data'&lt;/SPAN&gt;&lt;SPAN&gt;[Units]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Now I want to be able to apply a filter to it. For example, if I select only 2 competitors, I want the weighted average of only those products that are present in both of the selected competitors. Right now, the weighted average stays the same, no matter which competitor I select. I already tried a bunch of different stuff but it always stays unchanged.... Can someone please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 12:51:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4694365#M179778</guid>
      <dc:creator>sunnycube</dc:creator>
      <dc:date>2025-05-15T12:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted average of the only the products that appear in ALL selected columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4694482#M179785</link>
      <description>&lt;P&gt;You can try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Weighted Average =
VAR Companies =
    CALCULATETABLE (
        VALUES ( 'Example Data'[Competitor] ),
        ALLSELECTED ( 'Example Data'[Competitor] )
    )
VAR NumCompanies =
    COUNTROWS ( Companies )
VAR CompaniesAndProducts =
    GENERATE ( Companies, CALCULATETABLE ( VALUES ( 'Example Data'[Product ID] ) ) )
VAR ProductsAndNumCompanies =
    GROUPBY (
        CompaniesAndProducts,
        'Example Data'[Product ID],
        "@num", SUMX ( CURRENTGROUP (), 1 )
    )
VAR ProductsInAll =
    FILTER ( ProductsAndNumCompanies, [@num] = NumCompanies )
VAR Result =
    CALCULATE (
        SUMX ( 'Example Data', 'Example Data'[Price] * 'Example Data'[Units] )
            / SUM ( 'Example Data'[Units] ),
        KEEPFILTERS ( ProductsInAll )
    )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 May 2025 13:48:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4694482#M179785</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-05-15T13:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted average of the only the products that appear in ALL selected columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4695254#M179822</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1276594" data-lia-user-login="sunnycube" class="lia-mention lia-mention-user"&gt;sunnycube&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;for the helpful response!&lt;BR /&gt;&lt;BR /&gt;I tried to recreate it with the sample data.Please find the file and screenshot.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I hope this resolve your query.If my answer meets your requirement,give us kudos and consider accepting it as solution.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Pallavi.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 05:37:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighted-average-of-the-only-the-products-that-appear-in-ALL/m-p/4695254#M179822</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-16T05:37:07Z</dc:date>
    </item>
  </channel>
</rss>

