<?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 rows based on multiple columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2106973#M48145</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;It seems your calculation was based on 4 columns because row 5 in your data is the same as row 1 based on Category A and Category B, and Color. (so, in the result for A, it should be 2, not 3).&lt;/P&gt;&lt;P&gt;But if you want the result based on the three categories and color=Red,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1- Add a new colum with this code :&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;&lt;LI-CODE lang="markup"&gt;New Column = 
'Table'[Category A]&amp;amp;'Table'[Category B]&amp;amp;'Table'[Category C]
//If you want the distinc count based on Cat A and B, remove "&amp;amp;'Table'[Category C]" from end of the code&lt;/LI-CODE&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;&lt;P&gt;2- try this measure to find the&amp;nbsp;&lt;SPAN&gt;count distinct rows:&lt;/SPAN&gt;&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;&lt;LI-CODE lang="markup"&gt;Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[New Column] ),
    FILTER ( 'Table', 'Table'[Color] = "Red" )
)&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;SPAN&gt;, please consider&amp;nbsp;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;it as the solution&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Appreciate your Kudos&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;STRONG&gt;!!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Sep 2021 02:30:12 GMT</pubDate>
    <dc:creator>VahidDM</dc:creator>
    <dc:date>2021-09-30T02:30:12Z</dc:date>
    <item>
      <title>Count distinct rows based on multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2106826#M48142</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can someone please help me with the Dax?&lt;BR /&gt;Need to count distinct rows based of three different columns - Category A, Catgeory B and Color = Red&lt;BR /&gt;If the row is duplicate - count only once.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sample Table -&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Expected Output -&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Category A&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 01:20:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2106826#M48142</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-30T01:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct rows based on multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2106973#M48145</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;It seems your calculation was based on 4 columns because row 5 in your data is the same as row 1 based on Category A and Category B, and Color. (so, in the result for A, it should be 2, not 3).&lt;/P&gt;&lt;P&gt;But if you want the result based on the three categories and color=Red,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1- Add a new colum with this code :&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;&lt;LI-CODE lang="markup"&gt;New Column = 
'Table'[Category A]&amp;amp;'Table'[Category B]&amp;amp;'Table'[Category C]
//If you want the distinc count based on Cat A and B, remove "&amp;amp;'Table'[Category C]" from end of the code&lt;/LI-CODE&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;&lt;P&gt;2- try this measure to find the&amp;nbsp;&lt;SPAN&gt;count distinct rows:&lt;/SPAN&gt;&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;&lt;LI-CODE lang="markup"&gt;Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[New Column] ),
    FILTER ( 'Table', 'Table'[Color] = "Red" )
)&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;SPAN&gt;, please consider&amp;nbsp;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;it as the solution&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Appreciate your Kudos&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;STRONG&gt;!!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 02:30:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2106973#M48145</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-09-30T02:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct rows based on multiple columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2107034#M48149</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In my opinion, if you are "counting rows - distinct" based on more than two columns, the DAX function - SUMMARIZE helps.&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;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;EM&gt;Expected result measure : = &lt;/EM&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;COUNTROWS (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;FILTER (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;SUMMARIZE ( Data, Data[Category B], Data[Category C], Data[Color] ),&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;Data[Color] = "red"&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 Sep 2021 03:03:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-distinct-rows-based-on-multiple-columns/m-p/2107034#M48149</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2021-09-30T03:03:10Z</dc:date>
    </item>
  </channel>
</rss>

