<?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 of Duplicates based on other Column Criteria in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3492559#M133747</link>
    <description>&lt;P&gt;=COUNTROWS(FILTER(ALL(Table[Policy Number]),ISEMPTY(EXCEPT(CALCULATETABLE(VALUES(Table[Product])),{"Cash","SIPP"}))))&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2023 00:04:19 GMT</pubDate>
    <dc:creator>wdx223_Daniel</dc:creator>
    <dc:date>2023-10-24T00:04:19Z</dc:date>
    <item>
      <title>Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3491598#M133689</link>
      <description>&lt;P&gt;In the table below if a policy number is duplicated then it means that client has more than one product.&lt;/P&gt;&lt;P&gt;For Example ED99887 has a 'Cash' Product and a 'SIPP' Product.&amp;nbsp;I need a solution that can count that example as 1 but also exclude any other examples where the Products are different.&lt;/P&gt;&lt;P&gt;For Example ED47891 is duplicated and has a 'Pension' Product and a 'SIPP' Product but doesn’t need to be counted because the Products are different to 'Cash' &amp;amp; 'SIPP'.&lt;/P&gt;&lt;P&gt;It also needs to exclude non duplicated policy numbers and where there are more than 2 policy numbers duplicated (e.g. ED14522).&lt;/P&gt;&lt;P&gt;ED1455 is duplicated and has a products 'Cash' &amp;amp; 'SIPP' but also needs to be excluded because it also has the product 'Pension' linked to the policy number.&lt;/P&gt;&lt;P&gt;In the table below once the calulation is done I need the answer to be 3 because there are only 3 occurances where a client has a Cash Product &amp;amp; a SIPP Product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 14:11:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3491598#M133689</guid>
      <dc:creator>Mikey575</dc:creator>
      <dc:date>2023-10-23T14:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3492559#M133747</link>
      <description>&lt;P&gt;=COUNTROWS(FILTER(ALL(Table[Policy Number]),ISEMPTY(EXCEPT(CALCULATETABLE(VALUES(Table[Product])),{"Cash","SIPP"}))))&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 00:04:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3492559#M133747</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-24T00:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3493720#M133822</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;Thanks for your solution but based on my table it is giving me the answer of 5 when the answer I need is 3.&lt;/P&gt;&lt;P&gt;The senario is if a policy number is duplicated then that means there is more than 1 product. If there are 2 policy numbers the same then there are 2 products. 3 same policy numbers = 3 Products and so on.&lt;/P&gt;&lt;P&gt;I need to know how many clients have 2 products and the 2 products they have are SIPP &amp;amp; Cash. Any other senario doesnt need to be counted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore what I need the calculation to do is count the 3 cases where the Policy Number appears only twice and each 1 is Product SIPP &amp;amp; Product Cash. In my table example the 3 Policy numbers it should only be counting are ED23567, ED58967 &amp;amp; ED99887.&lt;/P&gt;&lt;P&gt;Many thanks for looking at this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 11:23:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3493720#M133822</guid>
      <dc:creator>Mikey575</dc:creator>
      <dc:date>2023-10-24T11:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494191#M133841</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="612208" data-lia-user-login="Mikey575" class="lia-mention lia-mention-user"&gt;Mikey575&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Amazed by the brevity of&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;'s code and found it would miscount&amp;nbsp;ED34521 and&amp;nbsp;ED74562.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
COUNTROWS(
    FILTER(
        ALL(data[Policy Number]),
        CONCATENATEX(
            CALCULATETABLE(VALUES(data[Product])),
            data[Product],
            ", "
        ) = "Cash, SIPP"
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it worked like:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 14:43:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494191#M133841</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-10-24T14:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494435#M133852</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="612208" data-lia-user-login="Mikey575" class="lia-mention lia-mention-user"&gt;Mikey575&lt;/a&gt;, here is my suggested solution.&lt;/P&gt;&lt;P&gt;Create a measure as per below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Has only 1 SIPP and only 1 CASH = 
    SUMX(
        VALUES(YourTable[Policy Number]),
        VAR policynumber = YourTable[Policy Number]

        VAR cashproducts = CALCULATE(
            COUNTROWS(YourTable),
            YourTable[Product] = "Cash", YourTable[Policy Number] = policynumber
        )

        VAR sippproducts = CALCULATE(
            COUNTROWS(YourTable),
            YourTable[Product] = "SIPP", YourTable[Policy Number] = policynumber
        )

        VAR totalproducts = CALCULATE(COUNTROWS(YourTable), YourTable[Policy Number] = policynumber)
        VAR result = IF(cashproducts = 1 &amp;amp;&amp;amp; sippproducts = 1 &amp;amp;&amp;amp; totalproducts = 2, 1)
        RETURN result
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add a table visual to the report and drag in Policy Number and this measure. This gives the output below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 16:38:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494435#M133852</guid>
      <dc:creator>EylesIT</dc:creator>
      <dc:date>2023-10-24T16:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494443#M133853</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;Fantastic, that has worked for me. Is there an easy way to convert the formula so it counts those with with 3 Products, Cash, SIPP &amp;amp; ISA. All the other principles apply that is If you have 3 Products then the Policy Number will be the same for all 3.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 16:44:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494443#M133853</guid>
      <dc:creator>Mikey575</dc:creator>
      <dc:date>2023-10-24T16:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494972#M133882</link>
      <description>&lt;P&gt;if SIPP appeared firstly it will give a wrong result?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 23:42:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494972#M133882</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-24T23:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494973#M133883</link>
      <description>&lt;P&gt;&lt;SPAN&gt;=COUNTROWS(FILTER(ALL(Table[Policy Number]),VAR _p=CALCULATETABLE(VALUES(Table[Product])) RETURN COUNTROWS(_p)=2&amp;amp;&amp;amp;ISEMPTY(EXCEPT(_p,{"Cash","SIPP"}))))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 23:43:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3494973#M133883</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-24T23:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3495045#M133885</link>
      <description>&lt;P&gt;yes, indeed.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 01:23:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3495045#M133885</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-10-25T01:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Duplicates based on other Column Criteria</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3495063#M133886</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="612208" data-lia-user-login="Mikey575" class="lia-mention lia-mention-user"&gt;Mikey575&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;are you expecting like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = 
COUNTROWS (
    FILTER (
        ALL ( data[Policy Number] ),
        VAR _p =
            CALCULATETABLE ( VALUES ( data[Product] ) )
        RETURN
            COUNTROWS ( _p ) = 3
                &amp;amp;&amp;amp; ISEMPTY ( EXCEPT ( _p, { "Cash", "SIPP", "ISA" } ) )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Again, all credit to Daniel.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 01:39:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-of-Duplicates-based-on-other-Column-Criteria/m-p/3495063#M133886</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-10-25T01:39:45Z</dc:date>
    </item>
  </channel>
</rss>

