<?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: Using TOPN not giving expected result in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242767#M53745</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; SUMMARIZECOLUMNS can't be utilized in a measure. It only works in DAX table expression.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 15:38:27 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2021-12-16T15:38:27Z</dc:date>
    <item>
      <title>Using TOPN not giving expected result</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242392#M53727</link>
      <description>&lt;P&gt;Hi Experts&lt;BR /&gt;First I need to mention that this is through a live connection. All have a correct connection.&lt;BR /&gt;After reading several posts, I thought my measure was ready for the task, but no. There are two takeaways i want to use the measure for:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Getting the actual value for what ever "TOPN"-n i use.&lt;/LI&gt;&lt;LI&gt;Hold the values of "Postal Code" in new VAR for alternative measuer.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;My Measure:&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;#Top 20 PostalCodes SalesNet = &lt;BR /&gt;VAR _Exclude =&lt;BR /&gt; FILTER(&lt;BR /&gt; KEEPFILTERS(VALUES('Customer'[Customer Postal Code])),&lt;BR /&gt; 'Customer'[Customer Postal Code] &amp;lt;&amp;gt; "n/a"&lt;BR /&gt; )&lt;BR /&gt;&lt;BR /&gt;VAR _SalesPerCode =&lt;BR /&gt; SUMMARIZECOLUMNS(&lt;BR /&gt; Customer[Customer Postal Code],&lt;BR /&gt; _Exclude,&lt;BR /&gt; "Sales Net",[Sales Net]&lt;BR /&gt; )&lt;BR /&gt;&lt;BR /&gt;VAR _TOP20 =&lt;BR /&gt; TOPN(20,_SalesPerCode,0)&lt;BR /&gt;&lt;BR /&gt;VAR _Core =&lt;BR /&gt; SUMMARIZECOLUMNS(&lt;BR /&gt; Customer[Customer Postal Code],&lt;BR /&gt; _Exclude,&lt;BR /&gt; _TOP20,&lt;BR /&gt; "Sales_Net", [Sales Net]&lt;BR /&gt; )&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;&lt;BR /&gt;SUMX(_Core, [Sales_Net])&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;For the 1 point, I'm stuck on understanding why the this gives me the following error:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;For the 2 point im just plain stuck on how to solve this. When looking at this in DaxStudio, i get a table of the top sales net per postal code:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;I am convinced that I should be able to hold the "Postal code" to be used further in a variable.&lt;BR /&gt;Grateful for all help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Dec 2021 12:45:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242392#M53727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-16T12:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using TOPN not giving expected result</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242767#M53745</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; SUMMARIZECOLUMNS can't be utilized in a measure. It only works in DAX table expression.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 15:38:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242767#M53745</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-16T15:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using TOPN not giving expected result</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242921#M53756</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;&amp;nbsp;mentioned, while SUMMARIZECOLUMNS is great for DAX queries but isn't useful inside measures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think you need it here though. Try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#Top 20 PostalCodes SalesNet =
VAR _Exclude =
    FILTER (
        KEEPFILTERS ( VALUES ( 'Customer'[Customer Postal Code] ) ),
        'Customer'[Customer Postal Code] &amp;lt;&amp;gt; "n/a"
    )
VAR _SalesPerCode = ADDCOLUMNS ( _Exclude, "@SalesNet", [Sales Net] )
VAR _TOP20 = TOPN ( 20, _SalesPerCode, [@SalesNet] )
RETURN
    SUMX ( _TOP20, [@SalesNet] )
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Dec 2021 16:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2242921#M53756</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-16T16:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using TOPN not giving expected result</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2243932#M53799</link>
      <description>&lt;P&gt;Thx to both. Had missunderstood "SUMMARIZECOLUMNS" a bit outside queries&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;BR /&gt;Your edit gives the exact total as i was looking for, Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 07:21:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-TOPN-not-giving-expected-result/m-p/2243932#M53799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-17T07:21:21Z</dc:date>
    </item>
  </channel>
</rss>

