<?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: TOPN with variable table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065572#M161398</link>
    <description>&lt;P&gt;thank you so much for considering some patterns!&lt;BR /&gt;I'm afraid to say that each of them was unsucess,but one of my trial seems to be successed.I have no idea why it works... anyway,I deal with it as solved.&lt;BR /&gt;&lt;BR /&gt;test_topn:=&lt;BR /&gt;VAR PN_PO =&lt;BR /&gt;SUMMARIZE (&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;allselected&lt;/STRONG&gt;&lt;/FONT&gt;('TEST_'),&lt;/P&gt;</description>
    <pubDate>Sun, 28 Jul 2024 14:43:36 GMT</pubDate>
    <dc:creator>ohnothimagain</dc:creator>
    <dc:date>2024-07-28T14:43:36Z</dc:date>
    <item>
      <title>TOPN with variable table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065035#M161375</link>
      <description>&lt;P&gt;Hello everyone,　&amp;nbsp; &amp;nbsp;(Special thanks to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt; ,privious time)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I've been stuck again in this week..this might be basic but I couldn't find a way to solve it..&lt;BR /&gt;I have a table below,want to get Top2 [PN] with several conditions( as follows,summarize and limit number of count) .&lt;BR /&gt;Result of DAX contains unneeded PN.how should I correct it??&lt;BR /&gt;&lt;BR /&gt;■Table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;■DAX&lt;/P&gt;&lt;P&gt;test_topn:=&lt;BR /&gt;VAR PN_PO =SUMMARIZE ( 'TEST_','TEST_'[PN],TEST_[PO],'TEST_'[Qty])&lt;BR /&gt;VAR PN_PO_Count =GROUPBY ( PN_PO,'TEST_'[PN], "@PO_Count",&lt;BR /&gt;　　　　　　　　SUMX ( CURRENTGROUP (), 1 ),"@SUM",sumx(CURRENTGROUP(),'TEST_'[Qty]))&lt;BR /&gt;VAR PN_Filtered =FILTER (PN_PO_COUNT, [@PO_Count] &amp;gt; 2 )&lt;BR /&gt;VAR Ftd=topn(2,PN_Filtered,[@SUM],DESC)&lt;BR /&gt;return calculate(sum('TEST_'[Qty]),KEEPFILTERS(Ftd))&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;■Result&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jul 2024 16:55:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065035#M161375</guid>
      <dc:creator>ohnothimagain</dc:creator>
      <dc:date>2024-07-27T16:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: TOPN with variable table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065160#M161379</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;BR /&gt;&lt;BR /&gt;I would suggest this Dax to use for your purpose I have done modifiactions in summarize and group by and I suppose it works, I can not test it as I do not have your table,&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;Dax:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;test_topn&lt;/STRONG&gt; :=&lt;BR /&gt;VAR PN_PO =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;'TEST_',&lt;BR /&gt;'TEST_'[PN],&lt;BR /&gt;'TEST_'[PO],&lt;BR /&gt;"QtySum", SUM('TEST_'[Qty])&lt;BR /&gt;)&lt;BR /&gt;VAR PN_PO_Count =&lt;BR /&gt;GROUPBY (&lt;BR /&gt;PN_PO,&lt;BR /&gt;'TEST_'[PN],&lt;BR /&gt;"PO_Count", COUNTX ( CURRENTGROUP (), 'TEST_'[PO] ),&lt;BR /&gt;"QtyTotal", SUMX ( CURRENTGROUP (), [QtySum] )&lt;BR /&gt;)&lt;BR /&gt;VAR PN_Filtered =&lt;BR /&gt;FILTER ( PN_PO_Count, [PO_Count] &amp;gt; 2 )&lt;BR /&gt;VAR Top2 =&lt;BR /&gt;TOPN ( 2, PN_Filtered, [QtyTotal], DESC )&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'TEST_'[Qty] ),&lt;BR /&gt;KEEPFILTERS ( Top2 )&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Please see the response and share with me if it was helpful. You can contact me anytime for further discussion or for changes, if you have another types of requirements here in this task,&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;I look forward to your response,&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&amp;nbsp;&lt;BR /&gt;Tamar&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jul 2024 20:05:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065160#M161379</guid>
      <dc:creator>twi1</dc:creator>
      <dc:date>2024-07-27T20:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: TOPN with variable table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065301#M161386</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="781704" data-lia-user-login="twi1" class="lia-mention lia-mention-user"&gt;twi1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thank you for responding quckly! I copied and tried it right away,but unfortunately&lt;BR /&gt;result was the same..(I'm using PowerPivot for Excel,sorry for inconvenience.)&lt;BR /&gt;alternated formula to confirm the operation as follows was successed,but couldn't apply to "PN_Filtered"&lt;BR /&gt;Could you give me some more solutions..?&lt;BR /&gt;&lt;BR /&gt;top3:=var top3=topn(3,&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;allselected&lt;/STRONG&gt;&lt;/FONT&gt;('TEST_'),'TEST_'[Qty],DESC)&lt;BR /&gt;return calculate(sum('TEST_'[Qty]),keepfilters(top3))&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jul 2024 02:49:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065301#M161386</guid>
      <dc:creator>ohnothimagain</dc:creator>
      <dc:date>2024-07-28T02:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: TOPN with variable table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065493#M161395</link>
      <description>&lt;P&gt;Maybe, you can try these measures, any of them:test_topn :=&lt;BR /&gt;VAR PN_PO =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;'TEST_',&lt;BR /&gt;'TEST_'[PN],&lt;BR /&gt;'TEST_'[PO],&lt;BR /&gt;'TEST_'[Qty]&lt;BR /&gt;)&lt;BR /&gt;VAR PN_PO_Count =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;PN_PO,&lt;BR /&gt;'TEST_'[PN]&lt;BR /&gt;),&lt;BR /&gt;"@PO_Count", CALCULATE ( COUNT ( 'TEST_'[PO] ) ),&lt;BR /&gt;"@SUM", CALCULATE ( SUM ( 'TEST_'[Qty] ) )&lt;BR /&gt;)&lt;BR /&gt;VAR PN_Filtered =&lt;BR /&gt;FILTER (&lt;BR /&gt;PN_PO_Count,&lt;BR /&gt;[@PO_Count] &amp;gt; 2&lt;BR /&gt;)&lt;BR /&gt;VAR TopPNs =&lt;BR /&gt;TOPN (&lt;BR /&gt;2,&lt;BR /&gt;PN_Filtered,&lt;BR /&gt;[@SUM],&lt;BR /&gt;DESC&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'TEST_'[Qty] ),&lt;BR /&gt;KEEPFILTERS ( TopPNs )&lt;BR /&gt;)&lt;BR /&gt;or that one:&lt;BR /&gt;test_topn :=&lt;BR /&gt;VAR top2 =&lt;BR /&gt;TOPN (&lt;BR /&gt;2,&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;ALLSELECTED('TEST_'),&lt;BR /&gt;'TEST_'[PN],&lt;BR /&gt;"QtySum", SUM ( 'TEST_'[Qty] ),&lt;BR /&gt;"PO_Count", COUNT ( 'TEST_'[PO] )&lt;BR /&gt;),&lt;BR /&gt;[QtySum],&lt;BR /&gt;DESC&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'TEST_'[Qty] ),&lt;BR /&gt;KEEPFILTERS ( top2 ),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALLSELECTED('TEST_'),&lt;BR /&gt;[PO_Count] &amp;gt; 2&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;or that one:test_topn :=&lt;BR /&gt;VAR PN_PO =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;'TEST_',&lt;BR /&gt;'TEST_'[PN],&lt;BR /&gt;'TEST_'[PO],&lt;BR /&gt;"QtySum", SUM('TEST_'[Qty])&lt;BR /&gt;)&lt;BR /&gt;VAR PN_PO_Count =&lt;BR /&gt;SUMMARIZE (&lt;BR /&gt;PN_PO,&lt;BR /&gt;'TEST_'[PN],&lt;BR /&gt;"PO_Count", COUNT('TEST_'[PO]),&lt;BR /&gt;"QtyTotal", SUM('TEST_'[QtySum])&lt;BR /&gt;)&lt;BR /&gt;VAR PN_Filtered =&lt;BR /&gt;FILTER (PN_PO_Count, [PO_Count] &amp;gt; 2)&lt;BR /&gt;VAR Top2 =&lt;BR /&gt;TOPN(2, PN_Filtered, [QtyTotal], DESC)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM('TEST_'[Qty]),&lt;BR /&gt;KEEPFILTERS(Top2)&lt;BR /&gt;) Try each of them maybe this gives you a way to better solution for power pivot in excel&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jul 2024 12:09:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065493#M161395</guid>
      <dc:creator>twi1</dc:creator>
      <dc:date>2024-07-28T12:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: TOPN with variable table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065572#M161398</link>
      <description>&lt;P&gt;thank you so much for considering some patterns!&lt;BR /&gt;I'm afraid to say that each of them was unsucess,but one of my trial seems to be successed.I have no idea why it works... anyway,I deal with it as solved.&lt;BR /&gt;&lt;BR /&gt;test_topn:=&lt;BR /&gt;VAR PN_PO =&lt;BR /&gt;SUMMARIZE (&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;allselected&lt;/STRONG&gt;&lt;/FONT&gt;('TEST_'),&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jul 2024 14:43:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOPN-with-variable-table/m-p/4065572#M161398</guid>
      <dc:creator>ohnothimagain</dc:creator>
      <dc:date>2024-07-28T14:43:36Z</dc:date>
    </item>
  </channel>
</rss>

