<?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 N and Others in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2776520#M86704</link>
    <description>&lt;P&gt;Appreciate your help!! Genius! It works now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 05:32:28 GMT</pubDate>
    <dc:creator>Suzy123</dc:creator>
    <dc:date>2022-09-19T05:32:28Z</dc:date>
    <item>
      <title>Top N and Others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2774841#M86566</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am doing a top 5 plus others for my report, and it works fine until i put the month in the columns it will show top 5 for each month and Total column will only add the Top 5 based on the total result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The measure I created is as below, and this is how it looks before I put the Month in the Columns:&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;&lt;P&gt;This is how it looks after I put the Month in the columns:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone has any idea how to resolve this... it seems so hard, and the result I want is just&amp;nbsp;&lt;/P&gt;&lt;P&gt;&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;Mesure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Top N Sum Sales = 
VAR TopSalesTable =
    TOPN (
        5,
        ALLSELECTED ('Unique Customers'),
        [Total Sales]
    )
VAR TopSales =
    CALCULATE (
        [Total Sales],
        KEEPFILTERS ( TopSalesTable )
    )
VAR OtherSales =
    CALCULATE (                  
        [Total Sales],
        ALLSELECTED ('Unique Customers' )
    )
        - CALCULATE (                        
            [Total Sales],
            TopSalesTable
        )
VAR CurrentProd = SELECTEDVALUE ( 'Unique Customers'[Customer name] )
RETURN
    IF (                                     
        CurrentProd &amp;lt;&amp;gt; "Others",
        TopSales,
        OtherSales
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2022 06:48:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2774841#M86566</guid>
      <dc:creator>Suzy123</dc:creator>
      <dc:date>2022-09-17T06:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Top N and Others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2774848#M86567</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I tried to simplify the sample and created a new sample pbix file like below. (top3 and others)&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I hope the below can provide some ideas on how to create a solution for your data model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 3 sales and others: =
VAR _topthreecustomerlistwholeyear =
    TOPN (
        3,
        ALLSELECTED ( Customer[Customer] ),
        CALCULATE ( [Sales total:], REMOVEFILTERS ( 'Calendar' ) ), DESC
    )
VAR _topthreefilter =
    TOPN ( 3, ALLSELECTED ( Customer[Customer] ), [Sales total:], DESC )
VAR _allsales =
    CALCULATE ( [Sales total:], REMOVEFILTERS ( Customer ) )
VAR _othersales =
    _allsales - CALCULATE ( [Sales total:], _topthreefilter )
RETURN
    SWITCH (
        TRUE (),
        HASONEVALUE ( Customer[Customer] ),
            IF (
                SELECTEDVALUE ( Customer[Customer] ) = "Others",
                _othersales,
                CALCULATE (
                    [Sales total:],
                    KEEPFILTERS ( Customer[Customer] IN _topthreecustomerlistwholeyear )
                )
            ),
        [Sales total:]
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2022 07:31:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2774848#M86567</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-09-17T07:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Top N and Others</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2776520#M86704</link>
      <description>&lt;P&gt;Appreciate your help!! Genius! It works now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 05:32:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-N-and-Others/m-p/2776520#M86704</guid>
      <dc:creator>Suzy123</dc:creator>
      <dc:date>2022-09-19T05:32:28Z</dc:date>
    </item>
  </channel>
</rss>

