<?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: Top 10 - DAX formula optimization in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1527084#M29913</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="34484" data-lia-user-login="danm" class="lia-mention lia-mention-user"&gt;danm&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Essentially it is doing what you did in a more direct way.&amp;nbsp; Your code was a bit convoluted.&lt;/P&gt;
&lt;P&gt;To be quite honest though, I wouldn't expect the improvement to be really big ex ante. I'd need to see the full pbix to be able to provide a more accurate answer.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 18:08:12 GMT</pubDate>
    <dc:creator>AlB</dc:creator>
    <dc:date>2020-12-01T18:08:12Z</dc:date>
    <item>
      <title>Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525247#M29841</link>
      <description>&lt;P&gt;Hi Experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to create a measure to create Top 1o Customer by number of products bought.&lt;BR /&gt;I use the following formulas:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Customer Rank = RANKX(ALL(Sales_Fact[CustomerNumber]), [Total Sales], ,ASC)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Top 10 Customers by Prod # =&lt;BR /&gt;VAR&lt;BR /&gt;RankingContext = VALUES( Account_Dim[Name] )&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE( [No of unique Products],&lt;BR /&gt;TOPN( 10, ALL( Account_Dim[Name] ), [No of unique Products] ),&lt;BR /&gt;RankingContext ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is taking around 5 min to display a table with 10 CustomerName and Rank. The tables are not huge: Account aprox 90.ooo rows and Sales aprox 120.000.&amp;nbsp; The memory and cpu used around 30-40%.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be very much appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 02:11:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525247#M29841</guid>
      <dc:creator>danm</dc:creator>
      <dc:date>2020-12-01T02:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525257#M29842</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;No of unique Products = DISTINCTCOUNT(Sales_Fact[ProductNumber])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Dec 2020 02:16:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525257#M29842</guid>
      <dc:creator>danm</dc:creator>
      <dc:date>2020-12-01T02:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525298#M29849</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="34484" data-lia-user-login="danm" class="lia-mention lia-mention-user"&gt;danm&lt;/a&gt; , do you have any bi-directional joins. and having a slicer for those bi-directional joins. Make bi-directional join and try .&lt;/P&gt;
&lt;P&gt;Small variation in second formula&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No of unique Products = DISTINCTCOUNT(Sales_Fact[ProductNumber])&lt;/P&gt;
&lt;P&gt;Top 10 Customers by Prod # = &lt;BR /&gt;CALCULATE( [No of unique Products],&lt;BR /&gt;TOPN( 10, ALL( Account_Dim[Name] ), [No of unique Products] ),&lt;BR /&gt;VALUES( Account_Dim[Name] ) )&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 02:36:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525298#M29849</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-12-01T02:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525329#M29851</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@&lt;A href="https://community.powerbi.com/t5/user/viewprofilepage/user-id/148838" target="_self"&gt;&lt;SPAN class="login-bold"&gt;amitchandak&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I activated cross filter direction = both, changed the formula but there is no changes.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Not sure about the slicer&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 02:54:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525329#M29851</guid>
      <dc:creator>danm</dc:creator>
      <dc:date>2020-12-01T02:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525487#M29859</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="34484" data-lia-user-login="danm" class="lia-mention lia-mention-user"&gt;danm&lt;/a&gt; , In the model view, check relations and try to convert&amp;nbsp; 1-M relation as single direction relation &lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 05:53:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525487#M29859</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-12-01T05:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525904#M29863</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="34484" data-lia-user-login="danm" class="lia-mention lia-mention-user"&gt;danm&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd need more details on the model, visual where measures are used etc. Can you share the pbix?&lt;/P&gt;
&lt;P&gt;The name for the measure [Top 10 Customers by Prod #] is a bit confusing, given what it seems to do.&lt;/P&gt;
&lt;P&gt;Try this in the meantime:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 10 Customers by Prod # V2 =
VAR rank_ =
    RANKX ( ALL ( Account_Dim[Name] ), [No of unique Products] )
RETURN
    IF ( rank_ &amp;lt;= 10, [No of unique Products] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 08:55:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1525904#M29863</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-01T08:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1526142#M29873</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;Is simple and fast ! Great solution. We all appreciate if you add some comments to point us in right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 10:36:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1526142#M29873</guid>
      <dc:creator>danm</dc:creator>
      <dc:date>2020-12-01T10:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 - DAX formula optimization</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1527084#M29913</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="34484" data-lia-user-login="danm" class="lia-mention lia-mention-user"&gt;danm&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Essentially it is doing what you did in a more direct way.&amp;nbsp; Your code was a bit convoluted.&lt;/P&gt;
&lt;P&gt;To be quite honest though, I wouldn't expect the improvement to be really big ex ante. I'd need to see the full pbix to be able to provide a more accurate answer.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:08:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-DAX-formula-optimization/m-p/1527084#M29913</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-01T18:08:12Z</dc:date>
    </item>
  </channel>
</rss>

