<?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 Average for a group with filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2747838#M84697</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="430232" data-lia-user-login="XR043" class="lia-mention lia-mention-user"&gt;XR043&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;First, I would try to see if your issue is solved by adding the Product_Category on your table on the left. There is a specific behavior when using ALLEXCEPT where if a column you are using in ALLEXCEPT is not preset in the filter context, it won't work.&lt;BR /&gt;&lt;BR /&gt;In your use case, Product_Category is not explicitly present in the table so you won't be able to use ALLEXCEPT for that column. Hope it helps.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Sep 2022 12:50:50 GMT</pubDate>
    <dc:creator>m3tr01d</dc:creator>
    <dc:date>2022-09-05T12:50:50Z</dc:date>
    <item>
      <title>Calculate Average for a group with filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2745796#M84560</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've struggled with these DAX for a while,&amp;nbsp; it should be easy but couldn't get the results I want. Hope to get your guidance on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to be able to compare the average sales for a product and the average sales for the product category which the product belongs to and for the specific store that's been selected, so I guess I want to calculate:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. the average sales for each product (by product_id), and&lt;/P&gt;&lt;P&gt;2. the average sales for each product category (product_category) by different stores (store_id). The store_id could be added as a slicer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I tried:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVG Customer Sales = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVERAGEX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Sales by Store'[quantity_sold]&lt;/SPAN&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'[unit_price]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVG Customer Sales_Category by StoreID = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[AVG Customer Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Product Lookup'[product_category]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Sales by Store'[store_id]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;However the snapshot below shows that I didnt actually achieve this. I think the AVG Customer Sales_Category by StoreID should show 21.10 which is the average for Coffee beans in Store 3, which the product (product_id =1) belongs to.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I was wondering if anyone can give me some ideas on what to do. Thank you.&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 04 Sep 2022 08:13:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2745796#M84560</guid>
      <dc:creator>XR043</dc:creator>
      <dc:date>2022-09-04T08:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Average for a group with filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2745831#M84562</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="430232" data-lia-user-login="XR043" class="lia-mention lia-mention-user"&gt;XR043&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please post a picture of your model?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 08:37:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2745831#M84562</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-09-04T08:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Average for a group with filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2745839#M84564</link>
      <description>&lt;P&gt;Yep, here's the model:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 08:43:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2745839#M84564</guid>
      <dc:creator>XR043</dc:creator>
      <dc:date>2022-09-04T08:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Average for a group with filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2747838#M84697</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="430232" data-lia-user-login="XR043" class="lia-mention lia-mention-user"&gt;XR043&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;First, I would try to see if your issue is solved by adding the Product_Category on your table on the left. There is a specific behavior when using ALLEXCEPT where if a column you are using in ALLEXCEPT is not preset in the filter context, it won't work.&lt;BR /&gt;&lt;BR /&gt;In your use case, Product_Category is not explicitly present in the table so you won't be able to use ALLEXCEPT for that column. Hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 12:50:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Average-for-a-group-with-filters/m-p/2747838#M84697</guid>
      <dc:creator>m3tr01d</dc:creator>
      <dc:date>2022-09-05T12:50:50Z</dc:date>
    </item>
  </channel>
</rss>

