<?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 How to create a filter with count in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576013#M73763</link>
    <description>&lt;P&gt;I would like to create a short table showing how much customers have bought how much product,s and I'm struggling getting the COUNT or COUNTROWS working as an expression within CALCULATE/CALCULATETABLE.&lt;BR /&gt;&lt;BR /&gt;Here my table :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And would like to get:&lt;BR /&gt;Nbr of Products&amp;nbsp; &amp;nbsp; &amp;nbsp;Nbr of Customers&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;BR /&gt;&lt;BR /&gt;How do I do that with DAX?&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2022 19:48:29 GMT</pubDate>
    <dc:creator>clo_64</dc:creator>
    <dc:date>2022-06-13T19:48:29Z</dc:date>
    <item>
      <title>How to create a filter with count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576013#M73763</link>
      <description>&lt;P&gt;I would like to create a short table showing how much customers have bought how much product,s and I'm struggling getting the COUNT or COUNTROWS working as an expression within CALCULATE/CALCULATETABLE.&lt;BR /&gt;&lt;BR /&gt;Here my table :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And would like to get:&lt;BR /&gt;Nbr of Products&amp;nbsp; &amp;nbsp; &amp;nbsp;Nbr of Customers&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;BR /&gt;&lt;BR /&gt;How do I do that with DAX?&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 19:48:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576013#M73763</guid>
      <dc:creator>clo_64</dc:creator>
      <dc:date>2022-06-13T19:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a filter with count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576032#M73765</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Coulld you explain why you have &lt;STRONG&gt;2 2&lt;/STRONG&gt; on the second line of your output?&amp;nbsp; Shouldn't it be &lt;STRONG&gt;2 1&lt;/STRONG&gt;, as only the customer Gamma has bought 2 products?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 20:20:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576032#M73765</guid>
      <dc:creator>ManguilibeKAO</dc:creator>
      <dc:date>2022-06-13T20:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a filter with count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576049#M73766</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="400656" data-lia-user-login="clo_64" class="lia-mention lia-mention-user"&gt;clo_64&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I got to a solution:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the DAX:&lt;/P&gt;&lt;PRE&gt;New Table = 
VAR _helpTable =
SUMMARIZE (
    TableCustomerProduct,
    TableCustomerProduct[Customer],
    "Nbr of Products", DISTINCTCOUNT ( TableCustomerProduct[Product] )
)
RETURN
SUMMARIZE (
    _helpTable,
    [Nbr of Products],
    "Nbr of Customers",
    CALCULATE (
        DISTINCTCOUNT ( 'TableCustomerProduct'[Customer] ),
        FILTER (
            VALUES ( 'TableCustomerProduct'[Customer] ),
            CALCULATE ( DISTINCTCOUNT ( TableCustomerProduct[Product] ) ) = [Nbr of Products]
        )
    )
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The _helpTable does a grouping on customer with a distinct count on product. The return statement uses the Number of Products from the _helptable combined&amp;nbsp; with a&amp;nbsp;&lt;A href="https://www.tackytech.blog/how-to-crack-the-mystery-of-the-mighty-dax/#filter-on-the-result-of-aggregate-functions-sql-having-clause" target="_self"&gt;"having clause"&lt;/A&gt;&amp;nbsp;in order to retrieve the number of customers per number of products&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="noopener"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="noopener"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 20:39:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2576049#M73766</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-06-13T20:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a filter with count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2577893#M73868</link>
      <description>&lt;P&gt;Excellent! Very smart this double SUMMARIZE!&lt;BR /&gt;Thanks Tom&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 14:16:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2577893#M73868</guid>
      <dc:creator>clo_64</dc:creator>
      <dc:date>2022-06-14T14:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a filter with count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2577896#M73869</link>
      <description>&lt;P&gt;Because Ypsilon has also bought 2 distint products.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 14:16:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-filter-with-count/m-p/2577896#M73869</guid>
      <dc:creator>clo_64</dc:creator>
      <dc:date>2022-06-14T14:16:48Z</dc:date>
    </item>
  </channel>
</rss>

