<?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: COUNT DISTINCT in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674672#M179030</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1268401" data-lia-user-login="racer25" class="lia-mention lia-mention-user"&gt;racer25&lt;/a&gt;&amp;nbsp;You need to create a measure that calculates the distinct count of Expense IDs for each worker and year, and handles cases where there are no claims correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;DistinctExpenseCount = &lt;BR /&gt;VAR DistinctCount = DISTINCTCOUNT('YourTable'[Expense ID])&lt;BR /&gt;RETURN&lt;BR /&gt;IF(DistinctCount = BLANK(), 0, DistinctCount)&lt;/P&gt;</description>
    <pubDate>Wed, 30 Apr 2025 12:22:34 GMT</pubDate>
    <dc:creator>bhanu_gautam</dc:creator>
    <dc:date>2025-04-30T12:22:34Z</dc:date>
    <item>
      <title>COUNT DISTINCT</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674637#M179029</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to PBI as our company has long since used Qlikview but transitioning to PBI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent a decent amount of time trying to figure this one out and while I am narrowing in on the answer I am either getting the wrong answer or errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 4 relebant fields&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Worker , Approval Date, Expense ID, Amount&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a table and want to show Worker, Sum Amount by Approval Date Year and Distinct Count of Expense ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum Amount by Year is done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count Distinct Expense ID's is my problem= If the Worker has no claims in the Year the Count is 1 not zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thought that could help? I have tried various add column options and DISTINCYCOUNTNOBLANKS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 12:00:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674637#M179029</guid>
      <dc:creator>racer25</dc:creator>
      <dc:date>2025-04-30T12:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: COUNT DISTINCT</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674672#M179030</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1268401" data-lia-user-login="racer25" class="lia-mention lia-mention-user"&gt;racer25&lt;/a&gt;&amp;nbsp;You need to create a measure that calculates the distinct count of Expense IDs for each worker and year, and handles cases where there are no claims correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;DistinctExpenseCount = &lt;BR /&gt;VAR DistinctCount = DISTINCTCOUNT('YourTable'[Expense ID])&lt;BR /&gt;RETURN&lt;BR /&gt;IF(DistinctCount = BLANK(), 0, DistinctCount)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 12:22:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674672#M179030</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-04-30T12:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: COUNT DISTINCT</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674726#M179031</link>
      <description>&lt;P&gt;Thanks so much - PBI didn't like the VAR Name of DistinctCount but a quick tweak and working. It also gave me an understanding of how to do it not just copy/[aste - appreciate the support&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 12:48:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/COUNT-DISTINCT/m-p/4674726#M179031</guid>
      <dc:creator>racer25</dc:creator>
      <dc:date>2025-04-30T12:48:37Z</dc:date>
    </item>
  </channel>
</rss>

