<?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: Exclude distinct count with OR in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013836#M44779</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317022" data-lia-user-login="Jos_Woolley" class="lia-mention lia-mention-user"&gt;Jos_Woolley&lt;/a&gt;&amp;nbsp; Thank you for your help. I am trying to understand the logic here. First, we are&amp;nbsp; counting all rows that have a word "Refused". Then, we are also counting all rows that have a word "Consented". Is it right? Then, what does the rest of statement mean? I think I understand what 'Except' means, but from what dataset (from all criteria - including others ('&lt;SPAN&gt;Historial', 'Not Eligible', etc.&lt;/SPAN&gt;)? Or am I totally off the track? Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Aug 2021 20:52:22 GMT</pubDate>
    <dc:creator>JustinDoh1</dc:creator>
    <dc:date>2021-08-12T20:52:22Z</dc:date>
    <item>
      <title>Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013704#M44772</link>
      <description>&lt;P&gt;I am trying to write DAX formula with following logic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count distinct "ClientID" if one has "Refused" in Consent column,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;BUT, if one has "Consented" in Consent column, do not count (exclude) distinct "ClientID".&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;So, client 69 and 12468 should be excluded from counting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my original DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Refused = CALCULATE (&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DISTINCTCOUNT( Table[ClientID] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Table[Consent] = "Refused" &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;---------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Do&amp;nbsp; I just subtract like this?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;Refused = CALCULATE (&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( DISTINCTCOUNT(&lt;/SPAN&gt;&lt;SPAN&gt;Table[ClientID] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;( Table[Consent] = "Refused" )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&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; &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;&lt;DIV&gt;&lt;SPAN&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(Table[Consent] = "Refused" &amp;amp;&amp;amp; Table[Consent] = "Consented"&amp;nbsp;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;I don't think it works.&lt;/P&gt;&lt;P&gt;I need to find the way to calculate the count ClientID level, not table level.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 18:45:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013704#M44772</guid>
      <dc:creator>JustinDoh1</dc:creator>
      <dc:date>2021-08-12T18:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013731#M44774</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the example you give, the only two possible entries in the 'Consent' column are 'Consented' and 'Refused'. As such, you can use:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Refused =
DISTINCTCOUNT ( 'Table'[ClientID] )
    - CALCULATE (
        DISTINCTCOUNT ( 'Table'[ClientID] ),
        'Table'[Consent] = "Consented"
    )&lt;/LI-CODE&gt;&lt;P&gt;If other entries are in fact possible within the 'Consent' column then please update your post with a more realistic dataset.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 18:46:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013731#M44774</guid>
      <dc:creator>Jos_Woolley</dc:creator>
      <dc:date>2021-08-12T18:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013735#M44775</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317022" data-lia-user-login="Jos_Woolley" class="lia-mention lia-mention-user"&gt;Jos_Woolley&lt;/a&gt;&amp;nbsp;Sorry. actually, there are different options for the value in the&amp;nbsp; "Consent" column (like 'Historial', 'Not Eligible').&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 18:50:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013735#M44775</guid>
      <dc:creator>JustinDoh1</dc:creator>
      <dc:date>2021-08-12T18:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013804#M44776</link>
      <description>&lt;P&gt;Ok, thanks for clarifying.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Refused Not Consented =
VAR Refused =
    DISTINCT (
        SUMMARIZE (
            FILTER ( 'Table', 'Table'[Consent] = "Refused" ),
            'Table'[ClientID]
        )
    )
VAR Consented =
    DISTINCT (
        SUMMARIZE (
            FILTER ( 'Table', 'Table'[Consent] = "Consented" ),
            'Table'[ClientID]
        )
    )
RETURN
    COUNTROWS ( EXCEPT ( Refused, Consented ) )&lt;/LI-CODE&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 19:46:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013804#M44776</guid>
      <dc:creator>Jos_Woolley</dc:creator>
      <dc:date>2021-08-12T19:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013836#M44779</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317022" data-lia-user-login="Jos_Woolley" class="lia-mention lia-mention-user"&gt;Jos_Woolley&lt;/a&gt;&amp;nbsp; Thank you for your help. I am trying to understand the logic here. First, we are&amp;nbsp; counting all rows that have a word "Refused". Then, we are also counting all rows that have a word "Consented". Is it right? Then, what does the rest of statement mean? I think I understand what 'Except' means, but from what dataset (from all criteria - including others ('&lt;SPAN&gt;Historial', 'Not Eligible', etc.&lt;/SPAN&gt;)? Or am I totally off the track? Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 20:52:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013836#M44779</guid>
      <dc:creator>JustinDoh1</dc:creator>
      <dc:date>2021-08-12T20:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013882#M44781</link>
      <description>&lt;P&gt;The first part:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR Refused =
DISTINCT (
    SUMMARIZE (
        FILTER ( 'Table', 'Table'[Consent] = "Refused" ),
        'Table'[ClientID]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;defines the variable 'Refused' as the single-column table comprising the distinct values from the ClientID column for which the Consent column entry is "Refused".&lt;/P&gt;&lt;P&gt;The next variable is similarly defined, though&amp;nbsp;for Consent column entries of "Consented".&lt;/P&gt;&lt;P&gt;The EXCEPT clause then returns a single-column table comprising all Client ID entries from the 'Refused' table which do not appear in the 'Consent' table.&lt;/P&gt;&lt;P&gt;Finally, the number of rows in this last table are counted.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 21:08:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013882#M44781</guid>
      <dc:creator>Jos_Woolley</dc:creator>
      <dc:date>2021-08-12T21:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013890#M44782</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317022" data-lia-user-login="Jos_Woolley" class="lia-mention lia-mention-user"&gt;Jos_Woolley&lt;/a&gt;&amp;nbsp;Thank you for your explanation. Now I understand what 'Except' does in DAX.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 21:16:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013890#M44782</guid>
      <dc:creator>JustinDoh1</dc:creator>
      <dc:date>2021-08-12T21:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude distinct count with OR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013892#M44783</link>
      <description>&lt;P&gt;You're welcome!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 21:18:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Exclude-distinct-count-with-OR/m-p/2013892#M44783</guid>
      <dc:creator>Jos_Woolley</dc:creator>
      <dc:date>2021-08-12T21:18:06Z</dc:date>
    </item>
  </channel>
</rss>

