<?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 for every customer row in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732362#M35909</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, thanks, I appreciate your help. Unfortunately I've already tried and the result is the same as the measure we tried before. I cannot do removefilters on a field while I'm doing a distinctcount on that field and displaying it on the visual:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I imagine there's no solution for that. That's not a trivial problem that can be resolve with a simple formula.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 09:10:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-03-19T09:10:22Z</dc:date>
    <item>
      <title>Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1728656#M35785</link>
      <description>&lt;P&gt;Hi, I have two tables: DimSubjects (dimension) where I have all the customer and a FactSales (fact table) where I have sales transaction. They are related by a subject key (one to many) and I display the data in a table visual (see image).&lt;/P&gt;&lt;P&gt;Nome, is the customer name and Documento di trasporto is the sales id:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want to create a new field in the visual in which I calculate the sum of all the distinct sales id for each client.&lt;/P&gt;&lt;P&gt;The result should be this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I tried to do the DISTINCTCOUNT(SalesId) but it creates a column of all 1 values.&lt;/P&gt;&lt;P&gt;How can I sum it and group it by customer and display it on every row that customer is displayed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 21:13:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1728656#M35785</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-17T21:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1729157#M35793</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , try a new column&lt;/P&gt;
&lt;P&gt;calculate(DISTINCTCOUNT(table[documentdo di transorto]) , filter(all(table), table[Nome] = earlier(table[Nome])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or a new measure&lt;/P&gt;
&lt;P&gt;calculate(DISTINCTCOUNT(table[documentdo di transorto]) , filter(all(table), table[Nome] = max(table[Nome])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 04:10:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1729157#M35793</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-03-18T04:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1729587#M35795</link>
      <description>&lt;P&gt;Hi, I've tried both your solutions but it still give me the value 1 in each row and that's not what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 08:04:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1729587#M35795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-18T08:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1730020#M35799</link>
      <description>&lt;P&gt;the solution is correct.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 10:11:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1730020#M35799</guid>
      <dc:creator>rfigtree</dc:creator>
      <dc:date>2021-03-18T10:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1730099#M35801</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;I used this measure:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;n° ddt = CALCULATE(DISTINCTCOUNT('F - Sales packing slip'[documentdo di transPorto]), FILTER(ALL('D - Subject'), 'D - Subject'[Nome] = MAX('D - Subject'[Nome])))&lt;BR /&gt;&lt;BR /&gt;and here it's the result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Maybe I've made some mistakes in the formula?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Mar 2021 10:31:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1730099#M35801</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-18T10:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1730742#M35819</link>
      <description>&lt;P&gt;Here's your measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;CALCULATE(
    COUNTROWS( FactSales ),
    REMOVEFILTERS( FactSales[Documentdo di transporto] )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 14:12:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1730742#M35819</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-18T14:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732151#M35902</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, thanks for your reply.&lt;/P&gt;&lt;P&gt;Unfortunately your measure causes this to happen (the result rows are multiplied endlessly and the count is not correct, it should be 6):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In the SalesTable there are multiple lines for each Documento di trasporto. For example this Documento di trasporto has two lines:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;so that's why for that Customer we have a count of 9 in total (it counts some documento di trasporto 2 times because they have two lines):&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;</description>
      <pubDate>Fri, 19 Mar 2021 08:00:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732151#M35902</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-19T08:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732299#M35907</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, I gave you an idea (I don't know the layout of your model and if I don't, then I can't guarantee 100% correctness of my solution, obviously)... You should have built on this. But I'll do it for you. Instead of COUNTROWS( FactTable ) use DISTINCTCOUNT( FactTable[Documento di transporto] ).&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 08:49:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732299#M35907</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-19T08:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732362#M35909</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, thanks, I appreciate your help. Unfortunately I've already tried and the result is the same as the measure we tried before. I cannot do removefilters on a field while I'm doing a distinctcount on that field and displaying it on the visual:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I imagine there's no solution for that. That's not a trivial problem that can be resolve with a simple formula.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 09:10:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732362#M35909</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-19T09:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732382#M35913</link>
      <description>&lt;P&gt;It's an easy problem but you are not giving us the full picture. Hence the difficulty. How one should write DAX depends heavily on the underlying model. We can't see the model, so... DAX is only a mere guess.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 09:15:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1732382#M35913</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-19T09:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1756963#M36695</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;, you're right. I was able to upload the file with the data in cloud, you can find it here:&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1c6k_mCotPjFSzj1vAgrRT97w2UqRwRW4/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1c6k_mCotPjFSzj1vAgrRT97w2UqRwRW4/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What I would like to do is to distinct count the field "Documento di trasporto" for each "Nome" in the time period selected on the upper time filter.&lt;/P&gt;&lt;P&gt;What I expect is the value 4 for COMEK SRL, 1 for F.R. ENGINEERING SRL and 14 for SACMI VERONA SPA&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 09:14:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1756963#M36695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-31T09:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757283#M36710</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's daxer but from a home PC, so I have a different user name. Please grant access to the file as I currently can't download it. Thx.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 11:13:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757283#M36710</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-03-31T11:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757286#M36711</link>
      <description>&lt;P&gt;Hi, granted!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 11:17:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757286#M36711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-31T11:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757388#M36719</link>
      <description>&lt;P&gt;Mate, you've changed names of the fields in the visual. This does not help &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; I can't even find the fields in the tables and I don't have time to hunt for them. You shouldn't have changed the names as it makes troubleshooting a lot harder.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 12:09:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757388#M36719</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-03-31T12:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757498#M36725</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created the measure but please remember next time &lt;STRONG&gt;not&lt;/STRONG&gt; to change the names of the fields in the visual as this makes it really much harder to work with the model for a person that has not worked with the model. Nobody wants to spend time on deciphering step by step, painstakingly, which field belongs to which table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the measure but I can't guarantee it'll be fast:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;The Count = 
var vCurrentSubjectID = DISTINCT( 'D - Subject'[Subject ID] )
var vResult =
    if( NOT ISEMPTY( 'F - Sales packing slip' ),
        CALCULATE(
            DISTINCTCOUNT( 'F - Sales packing slip'[Packing slip ID] ),
            'D - Subject'[Subject ID] in vCurrentSubjectID,
            ALLSELECTED( 'F - Sales packing slip' )
        )
    )
return
    vResult&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 12:34:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1757498#M36725</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-03-31T12:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count for every customer row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1759206#M36771</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255913" data-lia-user-login="daxer-almighty" class="lia-mention lia-mention-user"&gt;daxer-almighty&lt;/a&gt;&amp;nbsp; , now it works thanks to your help. I'm very sorry to have make you lose time for the names that I've changed in the report. It was the first time for me to share a file here, but now I've understand how to do that and, most of all how to implement that formula. Thank you and have a wonderful day.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 07:22:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-count-for-every-customer-row/m-p/1759206#M36771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-01T07:22:36Z</dc:date>
    </item>
  </channel>
</rss>

