<?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: Distinctcount filter by the result of a sum ? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2804138#M88354</link>
    <description>&lt;P&gt;with my example : I try to know over a lot of lines wich customer is a mono product owner (have a lonely domain) or a multi product owner (have a multi domain) but the filters must apply on the attributes of the domain (example Family or group : in text). If i take a group of domain, the filters have to apply across the whole groups selected ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example :&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DomID&lt;/TD&gt;&lt;TD&gt;DomLib&lt;/TD&gt;&lt;TD&gt;Family&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Bikes&lt;/TD&gt;&lt;TD&gt;Vehicles&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Cars&lt;/TD&gt;&lt;TD&gt;Vehicles&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Tomato&lt;/TD&gt;&lt;TD&gt;Vegetables&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Wed, 28 Sep 2022 20:50:38 GMT</pubDate>
    <dc:creator>SylvainC</dc:creator>
    <dc:date>2022-09-28T20:50:38Z</dc:date>
    <item>
      <title>Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802613#M88234</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;I have a table like this (with 67000000 rows ... and about 15000000 ClientID) :&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ClientID&lt;/TD&gt;&lt;TD&gt;DomID&lt;/TD&gt;&lt;TD&gt;Contract&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And i try to create a measure that gives me the number of customer that have only 1 contract&lt;/P&gt;&lt;P&gt;In my example : 1 (for ClientID 2)&lt;/P&gt;&lt;P&gt;And the second measure The number of customer that have more than one contract ...&lt;/P&gt;&lt;P&gt;in my example : 2 (for clientID 1 and 3)&lt;/P&gt;&lt;P&gt;In a calculate you can't use a filter based on the result of the sum so i don't find a solution for now ...&lt;/P&gt;&lt;P&gt;OnlyOneContract=CALCULATE(DISTINCTCOUNT(ClientID),FILTER(SUM(Contract)=1)&lt;/P&gt;&lt;P&gt;MoreThanOneContract=CALCULATE(DISTINCTCOUNT(ClientID),FILTER(SUM(Contract)&amp;gt;1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any ideas to help me ?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 11:28:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802613#M88234</guid>
      <dc:creator>SylvainC</dc:creator>
      <dc:date>2022-09-28T11:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802706#M88237</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274834" data-lia-user-login="SylvainC" class="lia-mention lia-mention-user"&gt;SylvainC&lt;/a&gt;&amp;nbsp;Hi,&amp;nbsp;&lt;BR /&gt;I think what needs to be done&lt;BR /&gt;1 calculate the number of contracts&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count_contract = COUNT('table (2)'[Contract])&lt;/LI-CODE&gt;
&lt;P&gt;2&amp;nbsp;Write a condition that will show which client has more than one contract&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;condition = 
IF( [Count_contract] = 1, "OnlyOneContract", "MoreThanOneContract")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:03:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802706#M88237</guid>
      <dc:creator>DimaMD</dc:creator>
      <dc:date>2022-09-28T12:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802732#M88240</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274834" data-lia-user-login="SylvainC" class="lia-mention lia-mention-user"&gt;SylvainC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a measure to get number of clients with 1 contract&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OnlyOneContract = 
COUNTROWS(
    FILTER(
        ADDCOLUMNS(
            VALUES(Sheet1[ClientID]),
            "@Contracts", CALCULATE(SUM(Sheet1[Contract]))
        ),
        [@Contracts] = 1
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;The MoreThanOneContract measure is similar - filter for [@Contracts] &amp;gt; 1 instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With your volume of data you might need to consider performance and memory usage.&lt;/P&gt;
&lt;P&gt;I tested on a dataset with 500,000 rows and 99,369 clients.&lt;/P&gt;
&lt;P&gt;If we look at DAX Studio server timings you can see that a table with 99,369 rows needs to be constructed in memory.&amp;nbsp; In your case that'll be a table with 15m rows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One option that springs to mind is calculating this at refresh time.&amp;nbsp; ie Make the contract count a calculated column rather than a measure.&amp;nbsp; Whether that makes sense depends on how slicers &amp;amp; filters should impact the calculations.&amp;nbsp; If someone were to slice on DomID = 2, would ClientID 1 now be in the OneContract or MoreThanOneContract bucket?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:14:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802732#M88240</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2022-09-28T12:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802752#M88242</link>
      <description>&lt;P&gt;Except that it's not working if you filter by Domain or attributes of the domaisn table ...&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:20:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802752#M88242</guid>
      <dc:creator>SylvainC</dc:creator>
      <dc:date>2022-09-28T12:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802802#M88248</link>
      <description>&lt;P&gt;It's contextual : You should filter and have different results when you put filters on Domain or attributes of domain ...&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:42:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802802#M88248</guid>
      <dc:creator>SylvainC</dc:creator>
      <dc:date>2022-09-28T12:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802835#M88254</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274834" data-lia-user-login="SylvainC" class="lia-mention lia-mention-user"&gt;SylvainC&lt;/a&gt;&amp;nbsp;OK, it needs to stay a measure then.&amp;nbsp; I'd suggest trying out the measure I wrote above and seeing what the performance is like.&amp;nbsp; You should try it out in PBI service too as the memory contraints will be different there than on your machine.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:56:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802835#M88254</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2022-09-28T12:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802921#M88259</link>
      <description>&lt;P&gt;But you can't visually filter a sum(measure) on a visual ...&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 13:23:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2802921#M88259</guid>
      <dc:creator>SylvainC</dc:creator>
      <dc:date>2022-09-28T13:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2803031#M88268</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274834" data-lia-user-login="SylvainC" class="lia-mention lia-mention-user"&gt;SylvainC&lt;/a&gt;&amp;nbsp;Could you explain in more detail what you're trying to do?&amp;nbsp; I don't follow.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 14:07:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2803031#M88268</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2022-09-28T14:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Distinctcount filter by the result of a sum ?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2804138#M88354</link>
      <description>&lt;P&gt;with my example : I try to know over a lot of lines wich customer is a mono product owner (have a lonely domain) or a multi product owner (have a multi domain) but the filters must apply on the attributes of the domain (example Family or group : in text). If i take a group of domain, the filters have to apply across the whole groups selected ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example :&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DomID&lt;/TD&gt;&lt;TD&gt;DomLib&lt;/TD&gt;&lt;TD&gt;Family&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Bikes&lt;/TD&gt;&lt;TD&gt;Vehicles&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Cars&lt;/TD&gt;&lt;TD&gt;Vehicles&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Tomato&lt;/TD&gt;&lt;TD&gt;Vegetables&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 28 Sep 2022 20:50:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinctcount-filter-by-the-result-of-a-sum/m-p/2804138#M88354</guid>
      <dc:creator>SylvainC</dc:creator>
      <dc:date>2022-09-28T20:50:38Z</dc:date>
    </item>
  </channel>
</rss>

