<?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 Count unique rows plan in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423360#M64286</link>
    <description>&lt;P&gt;Hello community!&lt;/P&gt;&lt;P&gt;I have a task, need your help to solve it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have two tables, one of them - date and month; second - customer and product ID's, number of line.&lt;/P&gt;&lt;P&gt;Based on one month (february) our goal is to count how many rows do we have in this month but with specific conditions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) If data in collum "contract" = "own production", "trading", then we count all those rows seperately as unique ones&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;If data in collum "contract" &amp;lt;&amp;gt; "own production", "trading", then we consider only unique data. For example we have 3 rows with same number 1817, in this case we count only as 1 unique row&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In example (february) we have 22 rows. So the goal in our example, considering conditios I mentioned abowe, should be 19 unique rows&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1TUw85W2_CQ0CTxdbkKqzNpf0Q0z9N5x7/view?usp=sharing" target="_self"&gt;Example file pbix&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you in advance!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Mar 2022 07:10:23 GMT</pubDate>
    <dc:creator>DimaMD</dc:creator>
    <dc:date>2022-03-29T07:10:23Z</dc:date>
    <item>
      <title>Count unique rows plan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423360#M64286</link>
      <description>&lt;P&gt;Hello community!&lt;/P&gt;&lt;P&gt;I have a task, need your help to solve it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have two tables, one of them - date and month; second - customer and product ID's, number of line.&lt;/P&gt;&lt;P&gt;Based on one month (february) our goal is to count how many rows do we have in this month but with specific conditions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) If data in collum "contract" = "own production", "trading", then we count all those rows seperately as unique ones&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;If data in collum "contract" &amp;lt;&amp;gt; "own production", "trading", then we consider only unique data. For example we have 3 rows with same number 1817, in this case we count only as 1 unique row&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In example (february) we have 22 rows. So the goal in our example, considering conditios I mentioned abowe, should be 19 unique rows&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1TUw85W2_CQ0CTxdbkKqzNpf0Q0z9N5x7/view?usp=sharing" target="_self"&gt;Example file pbix&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 07:10:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423360#M64286</guid>
      <dc:creator>DimaMD</dc:creator>
      <dc:date>2022-03-29T07:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique rows plan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423432#M64293</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the measure.&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;
&lt;LI-CODE lang="markup"&gt;fix measure =
VAR conditiontable =
    FILTER ( Plan, Plan[Contract] IN { "Own production", "Trading" } )
VAR nonconditiontable =
    SUMMARIZE ( EXCEPT ( Plan, conditiontable ), Plan[Contract] )
RETURN
    COUNTROWS ( conditiontable ) + COUNTROWS ( nonconditiontable )
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 07:36:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423432#M64293</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-03-29T07:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique rows plan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423441#M64294</link>
      <description>&lt;P&gt;In this example, you can use an IF() statement to check whether the column has the value you wish, and then returns a different count depending on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"IN()" checks the value against a list of values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EG&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table[Contract]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;IN&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;SPAN&gt;"Production"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Trading"&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(Table&lt;/SPAN&gt;&lt;SPAN&gt;[product ID]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; count&lt;/SPAN&gt;&lt;SPAN&gt;(Table&lt;/SPAN&gt;&lt;SPAN&gt;[product ID]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Does this work for you?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Pi&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 29 Mar 2022 07:39:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423441#M64294</guid>
      <dc:creator>PiEye</dc:creator>
      <dc:date>2022-03-29T07:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique rows plan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423513#M64300</link>
      <description>&lt;P&gt;Ні,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks for the help, your measure worked&lt;BR /&gt;&lt;BR /&gt;Greetings from Ukraine.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 08:04:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-unique-rows-plan/m-p/2423513#M64300</guid>
      <dc:creator>DimaMD</dc:creator>
      <dc:date>2022-03-29T08:04:07Z</dc:date>
    </item>
  </channel>
</rss>

