<?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: Number of Items Making up Top X% of Sales - Measure Very Slow in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2774459#M86538</link>
    <description>&lt;P&gt;Here is everything you need to know to write things like this:&amp;nbsp;&lt;A href="https://www.daxpatterns.com/abc-classification/" target="_blank"&gt;ABC classification – DAX Patterns&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 19:37:22 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-09-16T19:37:22Z</dc:date>
    <item>
      <title>Number of Items Making up Top X% of Sales - Measure Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2773921#M86479</link>
      <description>&lt;P&gt;I have a measure that returns the number of items that make up a given % of sales for a given customer. Visuals using the measure load very slowly...every other visual loads nearly instantly, and this one takes &amp;gt;1 minute. Any tips on ways to clean this up?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;NumberOfItems = 
VAR TotalSales = CALCULATE( [NetSales], ALL( 'dw dimItem' ) )
VAR ThreesholdPercentage = 0.5
RETURN
COUNTROWS(
    FILTER(
        CALCULATETABLE(
            ADDCOLUMNS(
                ADDCOLUMNS(
                    VALUES( 'dw dimItem'[ItemKey] ),
                    "TotalSalesOuter", [NetSales]
                ),
                "CumulatedPercentage",
                DIVIDE(
                    SUMX(
                        FILTER(
                                ADDCOLUMNS(
                                    VALUES( 'dw dimItem'[ItemKey] ),
                                    "TotalSalesInner", [NetSales]
                                ),
                                [TotalSalesInner] &amp;gt;= [TotalSalesOuter]
                        ),
                        [TotalSalesInner]
                    ),
                    TotalSales
                )
            ),
            ALL( 'dw dimItem' )
        ),
        [CumulatedPercentage] &amp;lt;= ThreesholdPercentage
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Sep 2022 15:12:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2773921#M86479</guid>
      <dc:creator>Brotedo</dc:creator>
      <dc:date>2022-09-16T15:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Items Making up Top X% of Sales - Measure Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2774459#M86538</link>
      <description>&lt;P&gt;Here is everything you need to know to write things like this:&amp;nbsp;&lt;A href="https://www.daxpatterns.com/abc-classification/" target="_blank"&gt;ABC classification – DAX Patterns&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 19:37:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2774459#M86538</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-09-16T19:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Items Making up Top X% of Sales - Measure Very Slow</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2776351#M86693</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="418667" data-lia-user-login="Brotedo" class="lia-mention lia-mention-user"&gt;Brotedo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your&amp;nbsp;description, When you put this measure in visuals, visuals become slow to load. Right?&lt;/P&gt;
&lt;P&gt;Here are a few things you can try to optimize your dax:&lt;/P&gt;
&lt;P&gt;(1)Filter the table as early as possible.&lt;/P&gt;
&lt;P&gt;(2)Simplify your logic.&lt;/P&gt;
&lt;P&gt;(3)Stop using&amp;nbsp; VALUES if you do not have to use them.&lt;/P&gt;
&lt;P&gt;You can refer to this document :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Performance-Tuning-DAX-Part-1/ba-p/976275" target="_self"&gt;Performance-DAX&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 02:29:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Number-of-Items-Making-up-Top-X-of-Sales-Measure-Very-Slow/m-p/2776351#M86693</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-09-19T02:29:30Z</dc:date>
    </item>
  </channel>
</rss>

