<?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: Distinct Count in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484685#M68163</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="380085" data-lia-user-login="QAA91" class="lia-mention lia-mention-user"&gt;QAA91&lt;/a&gt; ,I think it is better, you unpivot the fruits column and then these calculation would be easy &lt;/P&gt;
&lt;P&gt;&lt;A href="https://radacad.com/pivot-and-unpivot-with-power-bi" target="_blank"&gt;https://radacad.com/pivot-and-unpivot-with-power-bi&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Apr 2022 04:09:56 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-04-29T04:09:56Z</dc:date>
    <item>
      <title>Distinct Count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484664#M68162</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have sample of data that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table A&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Store&lt;/TD&gt;&lt;TD&gt;Fruit 1&lt;/TD&gt;&lt;TD&gt;Fruit 2&lt;/TD&gt;&lt;TD&gt;Fruit 3&lt;/TD&gt;&lt;TD&gt;Fruit 4&lt;/TD&gt;&lt;TD&gt;Fruit 5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;orange&lt;/TD&gt;&lt;TD&gt;orange&lt;/TD&gt;&lt;TD&gt;apple&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;banana&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;apple&lt;/TD&gt;&lt;TD&gt;dragonfruit&lt;/TD&gt;&lt;TD&gt;banana&lt;/TD&gt;&lt;TD&gt;peach&lt;/TD&gt;&lt;TD&gt;plum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;pear&lt;/TD&gt;&lt;TD&gt;jackfruit&lt;/TD&gt;&lt;TD&gt;pear&lt;/TD&gt;&lt;TD&gt;pear&lt;/TD&gt;&lt;TD&gt;jackfruit&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;watermelon&lt;/TD&gt;&lt;TD&gt;rapsberry&lt;/TD&gt;&lt;TD&gt;grape&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;grape&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I would like to create a new table where the output looks like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table B&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Store&lt;/TD&gt;&lt;TD&gt;Distinct Fruit By Rows&lt;/TD&gt;&lt;TD&gt;Total Distinct Fruit For All The Store&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 03:43:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484664#M68162</guid>
      <dc:creator>QAA91</dc:creator>
      <dc:date>2022-04-29T03:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484685#M68163</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="380085" data-lia-user-login="QAA91" class="lia-mention lia-mention-user"&gt;QAA91&lt;/a&gt; ,I think it is better, you unpivot the fruits column and then these calculation would be easy &lt;/P&gt;
&lt;P&gt;&lt;A href="https://radacad.com/pivot-and-unpivot-with-power-bi" target="_blank"&gt;https://radacad.com/pivot-and-unpivot-with-power-bi&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Apr 2022 04:09:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484685#M68163</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-04-29T04:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct Count</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484689#M68164</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;It is for creating a new table.&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;New Table B = 
ADDCOLUMNS (
    VALUES ( 'Table A'[Store] ),
    "@DistinctFruitByRow",
        COUNTROWS (
            SUMMARIZE (
                FILTER (
                    UNION (
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 1] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 2] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 3] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store],"@Fruit", 'Table A'[Fruit 4] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 5] )
                    ),
                    [@Store] = EARLIER ( 'Table A'[Store] )
                        &amp;amp;&amp;amp; [@Fruit] &amp;lt;&amp;gt; BLANK ()
                ),
                [@Fruit]
            )
        ),
    "@TotalDistinctFruit",
        IF (
            'Table A'[Store] = "A",
            COUNTROWS (
                SUMMARIZE (
                    FILTER (
                        UNION (
                            SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 1] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 2] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 3] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store],"@Fruit", 'Table A'[Fruit 4] ),
                        SELECTCOLUMNS ( 'Table A',"@Store", 'Table A'[Store], "@Fruit", 'Table A'[Fruit 5] )
                        ),
                        [@Fruit] &amp;lt;&amp;gt; BLANK ()
                    ),
                    [@Fruit]
                )
            )
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 29 Apr 2022 04:22:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Distinct-Count/m-p/2484689#M68164</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-04-29T04:22:14Z</dc:date>
    </item>
  </channel>
</rss>

