<?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: Distinct Count based on the sum of a metric in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1744796#M36275</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="292623" data-lia-user-login="jgb231" class="lia-mention lia-mention-user"&gt;jgb231&lt;/a&gt; , Not very clear, do you want to count customer net sales &amp;lt;&amp;gt; 0 where net sales is a measure. Ideally if there no negative amount, you are getting that only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you need to have a measure like&lt;/P&gt;
&lt;P&gt;Example measure&lt;/P&gt;
&lt;P&gt;countx(filter(Values(customer[Customer id]),[Net sales]&amp;lt;&amp;gt;0 ), [Customer id])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try a measure like above&lt;/P&gt;
&lt;P&gt;if not&lt;/P&gt;
&lt;P&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 07:36:24 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-03-25T07:36:24Z</dc:date>
    <item>
      <title>Distinct Count based on the sum of a metric</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1743701#M36246</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a current requirement to calculate the distinct number of customers who are buying producting within a given time period. This time period could be 1 day, 10 days, monthly, quarterly, etc.&amp;nbsp; The table is at the invoice line level.&amp;nbsp; The requirement is that within the given time period selected, to be counted, the customer had to have done business in which the sum of the sales amount is not zero.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The current calculation is as follows:&lt;/P&gt;&lt;P&gt;CustomerCount:=CALCULATE(DISTINCTCOUNT(Transactions[CustomerCount]),&lt;BR /&gt;FILTER(Transactions,[NetSales]&amp;lt;&amp;gt;0 )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;The filter measure is:&lt;/P&gt;&lt;P&gt;NetSales:=SUMX(filter(Transactions,Transactions[system_currency_adj_3rd_party_line_total_amt]&amp;lt;&amp;gt;0&amp;amp;&amp;amp;Transactions[is_revenue_ind]=1&amp;amp;&amp;amp;Transactions[Transaction_Type_Aggregate]="Net Sales"),Transactions[system_currency_adj_3rd_party_line_total_amt])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still end up with a handful of customers that are counted because their line items are both positive (invoice) and negative (credit) but should not because their total NetSales for the given period is 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the following:&lt;/P&gt;&lt;P&gt;CustomerCounttest:=&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT( Transactions[ParentPartnerID]),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALLEXCEPT(Transactions,&lt;BR /&gt;CALCULATE(sum(Transactions[NetInvoiceAmt]))&amp;lt;&amp;gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I end up with a memory exceeds the visualization error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This cannot be that hard of a scenario to solve for.&amp;nbsp; Please note this is currently deployed in Azure Analysis Services.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 19:45:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1743701#M36246</guid>
      <dc:creator>jgb231</dc:creator>
      <dc:date>2021-03-24T19:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count based on the sum of a metric</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1744796#M36275</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="292623" data-lia-user-login="jgb231" class="lia-mention lia-mention-user"&gt;jgb231&lt;/a&gt; , Not very clear, do you want to count customer net sales &amp;lt;&amp;gt; 0 where net sales is a measure. Ideally if there no negative amount, you are getting that only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you need to have a measure like&lt;/P&gt;
&lt;P&gt;Example measure&lt;/P&gt;
&lt;P&gt;countx(filter(Values(customer[Customer id]),[Net sales]&amp;lt;&amp;gt;0 ), [Customer id])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try a measure like above&lt;/P&gt;
&lt;P&gt;if not&lt;/P&gt;
&lt;P&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 07:36:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1744796#M36275</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-03-25T07:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count based on the sum of a metric</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1753016#M36589</link>
      <description>&lt;P&gt;The countx did it!&amp;nbsp; Thank you so much!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 00:54:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count-based-on-the-sum-of-a-metric/m-p/1753016#M36589</guid>
      <dc:creator>jgb231</dc:creator>
      <dc:date>2021-03-30T00:54:21Z</dc:date>
    </item>
  </channel>
</rss>

