<?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 DAX- Addcolumn and Count with simple condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052198#M160780</link>
    <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I'm completly stuck in this problem,wish anyone can give me a solution...(maybe easy)&lt;BR /&gt;I have a table below,and want to count [PN]numbers only adapted distinct [PO] counts over 2.&lt;BR /&gt;then, created measure below,but doesn't work...(seems Row context is OK,but Grand todal row is incorrect)&lt;BR /&gt;How should I correct this measure?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;■Table; TEST_&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;■Measure&lt;BR /&gt;test91:=var tbl=addcolumns(SUMMARIZE('TEST_','TEST_'[PN]),"@cnt",distinctcount('TEST_'[PO]))&lt;BR /&gt;var rst=countx(filter(tbl,[@cnt]&amp;gt;2),[@cnt])&lt;BR /&gt;return rst&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;■Result&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for reading.&lt;/P&gt;&lt;P&gt;&amp;nbsp;(my native language isn't English,sorry for inconvenient)&lt;/P&gt;</description>
    <pubDate>Sun, 21 Jul 2024 04:48:10 GMT</pubDate>
    <dc:creator>ohnothimagain</dc:creator>
    <dc:date>2024-07-21T04:48:10Z</dc:date>
    <item>
      <title>DAX- Addcolumn and Count with simple condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052198#M160780</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I'm completly stuck in this problem,wish anyone can give me a solution...(maybe easy)&lt;BR /&gt;I have a table below,and want to count [PN]numbers only adapted distinct [PO] counts over 2.&lt;BR /&gt;then, created measure below,but doesn't work...(seems Row context is OK,but Grand todal row is incorrect)&lt;BR /&gt;How should I correct this measure?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;■Table; TEST_&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;■Measure&lt;BR /&gt;test91:=var tbl=addcolumns(SUMMARIZE('TEST_','TEST_'[PN]),"@cnt",distinctcount('TEST_'[PO]))&lt;BR /&gt;var rst=countx(filter(tbl,[@cnt]&amp;gt;2),[@cnt])&lt;BR /&gt;return rst&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;■Result&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for reading.&lt;/P&gt;&lt;P&gt;&amp;nbsp;(my native language isn't English,sorry for inconvenient)&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 04:48:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052198#M160780</guid>
      <dc:creator>ohnothimagain</dc:creator>
      <dc:date>2024-07-21T04:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: DAX- Addcolumn and Count with simple condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052295#M160785</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="778360" data-lia-user-login="ohnothimagain" class="lia-mention lia-mention-user"&gt;ohnothimagain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;test91 :=
VAR PN_PO =
    SUMMARIZE ( 'TEST_', 'TEST_'[PN], 'TEST_'[PO] )
VAR PN_PO_Count =
    GROUPBY ( PN_PO, "@PO_Count", SUMX ( CURRENTGROUP (), 1 ) )
VAR PN_Filtered =
    FILTER ( PN_PO_COUNT, [@PO_Count] &amp;gt; 2 )
VAR Result =
    COUNTROWS ( PN_Filtered )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;The structure of the measure is similar to that shown in this article:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/apply-and-logic-to-multiple-selection-in-dax-slicer/" target="_blank"&gt;https://www.sqlbi.com/articles/apply-and-logic-to-multiple-selection-in-dax-slicer/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this work as intended?&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 08:37:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052295#M160785</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-07-21T08:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: DAX- Addcolumn and Count with simple condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052435#M160797</link>
      <description>&lt;P&gt;＠&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6799" target="_self"&gt;&lt;SPAN class=""&gt;OwenAuger&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;Thank you for responding quickly! (there's noone could in my coutry forums..)&lt;BR /&gt;I've copied your DAX and tried just now,Grand Total has changed but sadly something's still wrong..&lt;BR /&gt;I want to get value 3 but result is 1,could you give me more advice?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;P.S.&lt;BR /&gt;I checked in foumulas one by one and figured out suspicious part :&lt;BR /&gt;Argument "TEST_PN"&amp;nbsp; dropped off accidentally..?&lt;/P&gt;&lt;PRE&gt;GROUPBY ( PN_PO, "@PO_Count", SUMX ( CURRENTGROUP (), 1 ) )&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 14:26:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052435#M160797</guid>
      <dc:creator>ohnothimagain</dc:creator>
      <dc:date>2024-07-21T14:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: DAX- Addcolumn and Count with simple condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052474#M160806</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="778360" data-lia-user-login="ohnothimagain" class="lia-mention lia-mention-user"&gt;ohnothimagain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for testing this, and sorry for my typo! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You're exactly right, the measure should be&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;test91 :=
VAR PN_PO =
    SUMMARIZE ( 'TEST_', 'TEST_'[PN], 'TEST_'[PO] )
VAR PN_PO_Count =
    GROUPBY ( PN_PO, 'TEST_'[PN], "@PO_Count", SUMX ( CURRENTGROUP (), 1 ) )
VAR PN_Filtered =
    FILTER ( PN_PO_COUNT, [@PO_Count] &amp;gt; 2 )
VAR Result =
    COUNTROWS ( PN_Filtered )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;Does that work as intended?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 14:49:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4052474#M160806</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2024-07-21T14:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: DAX- Addcolumn and Count with simple condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4054334#M160898</link>
      <description>&lt;P&gt;Yes! it worked that I wanted it to be.thank you so much! It was really hard for me to solve by myself!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 16:14:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Addcolumn-and-Count-with-simple-condition/m-p/4054334#M160898</guid>
      <dc:creator>ohnothimagain</dc:creator>
      <dc:date>2024-07-22T16:14:30Z</dc:date>
    </item>
  </channel>
</rss>

