<?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 excluding value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896050#M186331</link>
    <description>&lt;P&gt;Hii&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1333082" data-lia-user-login="jwdal" class="lia-mention lia-mention-user"&gt;jwdal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="67" data-end="272"&gt;When you exclude a customer after calculating the Top 10, you end up with only 9 rows because the blank slot is not refilled. The fix is to remove the excluded customer before ranking. Example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 10 Excluding =
VAR CleanList =
FILTER(ALL(AC_ALL[Top10]), AC_ALL[Top10] &amp;lt;&amp;gt; "EXCLUDE")
RETURN
IF(
RANKX(CleanList, [Net Sales], , DESC) &amp;lt;= 10,
[Net Sales]
)&lt;/LI-CODE&gt;
&lt;P data-start="458" data-end="587" data-is-last-node="" data-is-only-node=""&gt;This way the ranking is done on a list where the excluded value is already removed, so Power BI always returns a full Top 10.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Dec 2025 14:38:16 GMT</pubDate>
    <dc:creator>rohit1991</dc:creator>
    <dc:date>2025-12-08T14:38:16Z</dc:date>
    <item>
      <title>Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896036#M186329</link>
      <description>&lt;P&gt;This formula kind of works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SP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gt;"EXCLUDE"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[Net Sales]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;() )))&lt;BR /&gt;&lt;BR /&gt;If the excluded customer is in the top 10, I only get 9 hits.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Dec 2025 14:32:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896036#M186329</guid>
      <dc:creator>jwdal</dc:creator>
      <dc:date>2025-12-08T14:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896049#M186330</link>
      <description>&lt;P&gt;Please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Alternatively, you can share your .pbix via some cloud service and paste the link here. Do not include sensitive information and do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided and make sure, in case you show a Power BI visual, to clarify the columns used in the grouping sections of the visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help uploading data? &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;click here &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;click here &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 14:37:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896049#M186330</guid>
      <dc:creator>FBergamaschi</dc:creator>
      <dc:date>2025-12-08T14:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896050#M186331</link>
      <description>&lt;P&gt;Hii&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1333082" data-lia-user-login="jwdal" class="lia-mention lia-mention-user"&gt;jwdal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="67" data-end="272"&gt;When you exclude a customer after calculating the Top 10, you end up with only 9 rows because the blank slot is not refilled. The fix is to remove the excluded customer before ranking. Example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 10 Excluding =
VAR CleanList =
FILTER(ALL(AC_ALL[Top10]), AC_ALL[Top10] &amp;lt;&amp;gt; "EXCLUDE")
RETURN
IF(
RANKX(CleanList, [Net Sales], , DESC) &amp;lt;= 10,
[Net Sales]
)&lt;/LI-CODE&gt;
&lt;P data-start="458" data-end="587" data-is-last-node="" data-is-only-node=""&gt;This way the ranking is done on a list where the excluded value is already removed, so Power BI always returns a full Top 10.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 14:38:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896050#M186331</guid>
      <dc:creator>rohit1991</dc:creator>
      <dc:date>2025-12-08T14:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896117#M186332</link>
      <description>&lt;P class=""&gt;&lt;SPAN&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1333082" data-lia-user-login="jwdal" class="lia-mention lia-mention-user"&gt;jwdal&lt;/a&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;The &lt;FONT face="comic sans ms,sans-serif" size="4" color="#FF0000"&gt;Issue here &lt;/FONT&gt;is that when the excluded customer is in the &lt;FONT face="comic sans ms,sans-serif" size="4" color="#FF0000"&gt;top 10 &lt;/FONT&gt;you are ranking &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;only 9 customers&lt;/FONT&gt;&lt;/STRONG&gt; with ranks 1-9 but checking for ≤10 so you only get 9 results....&lt;/SPAN&gt;&lt;SPAN&gt;Here are two better &lt;FONT face="comic sans ms,sans-serif"&gt;&lt;STRONG&gt;&lt;FONT color="#99CC00"&gt;Approaches&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;you can try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;FONT face="comic sans ms,sans-serif" size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;First Approach:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="4"&gt;Rank &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;first&lt;/STRONG&gt; &lt;/FONT&gt;then &lt;FONT color="#99CC00"&gt;&lt;STRONG&gt;exclude &lt;/STRONG&gt;&lt;/FONT&gt;(most robust)&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;In Top 10 =
VAR AllCustomers = ALL(AC_ALL[Top10])
VAR ExcludedValue = "EXCLUDE"
VAR RankedCustomers =
    ADDCOLUMNS(
        AllCustomers,
        "Rank", RANKX(AllCustomers, [Net Sales], , DESC),
        "Sales", [Net Sales]
    )
VAR Top10Customers =
    FILTER(
        RankedCustomers,
        [Rank] &amp;lt;= 10 &amp;amp;&amp;amp; [Top10] &amp;lt;&amp;gt; ExcludedValue
    )
VAR ResultCustomers =
    TOPN(
        10,
        Top10Customers,
        [Sales], DESC
    )
RETURN
    CALCULATE(
        [Net Sales],
        TREATAS(VALUES(SELECTCOLUMNS(ResultCustomers, "Customer", [Top10])), AC_ALL[Top10])
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="comic sans ms,sans-serif" size="4" color="#99CC00"&gt;&lt;STRONG&gt;Second Approach:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Using &lt;FONT color="#99CC00"&gt;TOPN&lt;/FONT&gt; with &lt;FONT color="#33CCCC"&gt;exclusion&lt;/FONT&gt; (&lt;FONT color="#FF0000"&gt;cleanest&lt;/FONT&gt; and&lt;FONT color="#FFCC00"&gt; most efficient &lt;/FONT&gt;one)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;In Top 10 =
VAR CustomersWithoutExclude = 
    FILTER(
        ALL(AC_ALL[Top10]),
        AC_ALL[Top10] &amp;lt;&amp;gt; "EXCLUDE"
    )
VAR Top10Customers =
    TOPN(
        10,
        CustomersWithoutExclude,
        [Net Sales], DESC
    )
RETURN
    CALCULATE(
        [Net Sales],
        KEEPFILTERS(AC_ALL[Top10] IN VALUES(Top10Customers[Top10]))
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;EM&gt;if this post helps, then I would appreciate a thumbs up&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;and&amp;nbsp;&lt;STRONG&gt;mark it as the solution&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;to help the other members find it more quickly.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Dec 2025 15:38:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896117#M186332</guid>
      <dc:creator>Ahmed-Elfeel</dc:creator>
      <dc:date>2025-12-08T15:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896130#M186333</link>
      <description>&lt;P&gt;Got an error message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cannot find table 'Top10Customers'&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 15:59:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896130#M186333</guid>
      <dc:creator>jwdal</dc:creator>
      <dc:date>2025-12-08T15:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896145#M186334</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1333082" data-lia-user-login="jwdal" class="lia-mention lia-mention-user"&gt;jwdal&lt;/a&gt;&amp;nbsp;,&amp;nbsp;Create a measure with what ever you want to exlcude&lt;/P&gt;
&lt;P&gt;Filter M = CALCULATE([Net Sales], keepfilters(AC_ALL[Top10] &amp;lt;&amp;gt; "EXCLUDE"))&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Top 10 = CALCULATE([Filter M], KEEPFILTERS(TOPN(10, ALL( AC_ALL[Top10]), [Filter M], DESC)))&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Top 10 = CALCULATE([Filter M], KEEPFILTERS(Window(0,ABS,10,ABS, ALL( AC_ALL[Top10]),ORDERBY([Filter M],Desc))))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Top 10 = CALCULATE([Filter M], KEEPFILTERS(TOPN(10, allselected( AC_ALL[Top10]), [Filter M], DESC)))&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Top 10 = CALCULATE([Filter M], KEEPFILTERS(Window(0,ABS,10,ABS, allselected( AC_ALL[Top10]),ORDERBY([Filter M],Desc))))&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 16:10:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896145#M186334</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2025-12-08T16:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896157#M186335</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1333082" data-lia-user-login="jwdal" class="lia-mention lia-mention-user"&gt;jwdal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Give this a try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Top 10 (excluding "EXCLUDE") =
VAR Top10CustomersExcluding =
    TOPN(
        10,
        FILTER(
            ALL(AC_ALL[Top10]),         -- remove current filters on the attribute
            AC_ALL[Top10] &amp;lt;&amp;gt; "EXCLUDE"  -- exclude first
        ),
        [Net Sales],
        DESC
    )
RETURN
CALCULATE(
    [Net Sales],
    KEEPFILTERS(Top10CustomersExcluding)  -- apply the TopN set to the current context
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ALL(AC_ALL[Top10]) resets any filtering on that column so ranking is global.&lt;BR /&gt;The FILTER removes "EXCLUDE" before the ranking happens.&lt;BR /&gt;TOPN then selects the Top 10 from those remaining.&lt;BR /&gt;KEEPFILTERS keeps this as a narrowing filter so it plays nicely in visuals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--------------------------------&lt;/P&gt;&lt;P&gt;I hope this helps, please give kudos and mark as solved if it does!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Connect with me on &lt;/SPAN&gt;&lt;A href="https://www.linkedin.com/in/alex-ward-30966b4b/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;LinkedIn&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Subscribe to my &lt;/SPAN&gt;&lt;A href="https://www.youtube.com/@AlexTechShed" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;YouTube channel&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; for Fabric/Power Platform related content!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 16:26:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896157#M186335</guid>
      <dc:creator>wardy912</dc:creator>
      <dc:date>2025-12-08T16:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Top 10 excluding value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896196#M186336</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1333082" data-lia-user-login="jwdal" class="lia-mention lia-mention-user"&gt;jwdal&lt;/a&gt;,&lt;BR /&gt;Try this instead it will work:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;In Top 10 =
VAR CustomersWithoutExclude = 
    FILTER(
        ALL(AC_ALL[Top10]),
        AC_ALL[Top10] &amp;lt;&amp;gt; "EXCLUDE"
    )
VAR Top10Customers =
    TOPN(
        10,
        CustomersWithoutExclude,
        [Net Sales], DESC
    )
RETURN
    CALCULATE(
        [Net Sales],
        KEEPFILTERS(AC_ALL[Top10] IN Top10Customers)
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Dec 2025 17:25:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-10-excluding-value/m-p/4896196#M186336</guid>
      <dc:creator>Ahmed-Elfeel</dc:creator>
      <dc:date>2025-12-08T17:25:10Z</dc:date>
    </item>
  </channel>
</rss>

