<?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 Products for Selected Brand and TOP N Products for All Other Brands in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099102#M108848</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;, thank you for the response. I'd like to do this without a disconnected table, as there are other product columns that might also be filtered. (I was trying to simplify the example). I would think this could be done without the disconnected table by using ALL/REMOVEFILTERS somewhere. Any thoughts?&lt;/P&gt;</description>
    <pubDate>Sat, 25 Feb 2023 03:36:39 GMT</pubDate>
    <dc:creator>msmays5</dc:creator>
    <dc:date>2023-02-25T03:36:39Z</dc:date>
    <item>
      <title>TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099078#M108846</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;&lt;EM&gt;Background&lt;/EM&gt;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I have a model with a basic star schema (tables in bold below)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Product&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Product Id&lt;/P&gt;&lt;P&gt;Product Name&lt;/P&gt;&lt;P&gt;Brand&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Market&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Market Id&lt;/P&gt;&lt;P&gt;Market Name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;Sales&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Market Id&lt;/P&gt;&lt;P&gt;Product Id&lt;/P&gt;&lt;P&gt;Total Sales&lt;/P&gt;&lt;P&gt;Total Unit Sales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I have the following base measures&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;$ Sales:&amp;nbsp;SUM ( Sales[Total Sales] )&lt;/P&gt;&lt;P&gt;Unit Sales: SUM ( Sales[Total Unit Sales] )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have a single selection slicer with the field Product[Brand].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;U&gt;&lt;EM&gt;Need&lt;/EM&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a table that displays&amp;nbsp;the Unit Sales for 10 products names:&amp;nbsp; the TOP 5 products by [$ Sales] of the selected brand AND the TOP 5 products by [$ Sales] of all other brands.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;U&gt;&lt;EM&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;Plan&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;I was trying to create a measure that can be used to filter the products that show up. I figured I could create a measure with two virtual tables: Top5FocusBrands and Top5NonFocusBrands and then UNION them together, add a column with a 1, and then filter to non-blanks. But I can't quite get this to work. Any ideas on how to approach this problem would be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 01:21:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099078#M108846</guid>
      <dc:creator>msmays5</dc:creator>
      <dc:date>2023-02-25T01:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099100#M108847</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.&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 datamodel.&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;&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 five focus brand and top five nonfocus brand: =
VAR _topfivefocus =
    TOPN (
        5,
        FILTER (
            ALL ( 'Product'[Product Name], 'Product'[Product ID], 'Product'[Brand] ),
            'Product'[Brand] IN DISTINCT ( 'Brand slicer table'[Brand] )
        ),
        [Total unit sales:], DESC
    )
VAR _nonfocus =
    EXCEPT (
        ALL ( 'Product'[Product Name], 'Product'[Product ID], 'Product'[Brand] ),
        _topfivefocus
    )
VAR _topfivenonfocus =
    TOPN ( 5, _nonfocus, [Total unit sales:], DESC )
RETURN
    CALCULATE ( [Total unit sales:], KEEPFILTERS ( _topfivefocus ) )
        + CALCULATE ( [Total unit sales:], KEEPFILTERS ( _topfivenonfocus ) )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 03:24:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099100#M108847</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-02-25T03:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099102#M108848</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;, thank you for the response. I'd like to do this without a disconnected table, as there are other product columns that might also be filtered. (I was trying to simplify the example). I would think this could be done without the disconnected table by using ALL/REMOVEFILTERS somewhere. Any thoughts?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 03:36:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099102#M108848</guid>
      <dc:creator>msmays5</dc:creator>
      <dc:date>2023-02-25T03:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099118#M108852</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Sorry but it is quite difficult for me to understand the full datamodel without seeing it.&lt;/P&gt;
&lt;P&gt;Do you want to select a specific Brand in the slicer, but you want to show all brands, and the slicer table is connected?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 03:59:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099118#M108852</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-02-25T03:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099119#M108853</link>
      <description>&lt;P&gt;Let me provide a sample file tomorrow morning to make this is as easy as possible to understand. Thank you again!&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 04:05:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099119#M108853</guid>
      <dc:creator>msmays5</dc:creator>
      <dc:date>2023-02-25T04:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099153#M108856</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="207035" data-lia-user-login="msmays5" class="lia-mention lia-mention-user"&gt;msmays5&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;My solution is pretty similar to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;'s except the the newly&amp;nbsp;created brand table is connect therefore it still can filter the other measures and visuals.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Top 10 = 
VAR ProductValues = 
    CALCULATETABLE ( VALUES ( 'Product'[Product Name] ), ALL ( Brands ) )
VAR SelectedProducts =
    CALCULATETABLE ( VALUES ( 'Product'[Product Name] ), ALLSELECTED ( ) )
VAR Top5Selected = 
    TOPN ( 5, SelectedProducts, [Sales Amount] )
VAR AllNotSelected = 
    FILTER ( ALL ( 'Product'[Product Name] ), NOT ( 'Product'[Product Name] IN SelectedProducts ) )
VAR Top5AllNotSelected =
    CALCULATETABLE ( TOPN ( 5, AllNotSelected, [Sales Amount] ), REMOVEFILTERS ( ) )
VAR FilterTable = UNION ( Top5Selected, Top5AllNotSelected )
VAR Result =
    SUMX ( 
        ProductValues,
        CALCULATE ( 
            [Sales Amount],
            ALL ( Brands ),
            FILTER ( 
                FilterTable,
                'Product'[Product Name] = EARLIER ( 'Product'[Product Name] )
            )
        )
    )
RETURN
    Result &lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 25 Feb 2023 06:31:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099153#M108856</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-25T06:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099392#M108877</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;Here is my &lt;A href="https://1drv.ms/u/s!ApiFb_juj94X7wl-zslgsjNESskw?e=TZfbYf" target="_self"&gt;file&lt;/A&gt;. I was able to implement like you showed with a disconnected table, and it worke. However, I'm wondering if there is any way to do this without an extra table. Ideally, I'd like to use the Product[BrandName] in the Slicer and have it work without creating an extra table for the slicer. But if this isn't possible, your solution works. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 17:25:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099392#M108877</guid>
      <dc:creator>msmays5</dc:creator>
      <dc:date>2023-02-25T17:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099673#M108913</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your file. I think the disconnected table is one of the optiops to go for the solution. I am not sure, but I don't think Brand column that comes from the same table as Product column does work in this case.&lt;/P&gt;
&lt;P&gt;Other way is to create a separate Brand table and create a relationship with product table, and then use Brand table - Brand column as a slicer.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2023 04:52:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099673#M108913</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-02-26T04:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099779#M108920</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="207035" data-lia-user-login="msmays5" class="lia-mention lia-mention-user"&gt;msmays5&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is a 2nd solution where no tables shall be added. However this shall require to create a new calculated column in the Sales table (ProductName) to use it to slice by the table visual.&lt;BR /&gt;Other than my 2 solutions and the one provided by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;, it is not possible. The reason is a property of the DAX SUMMARIZECOLUMNS of the Power Bi visuals called Auto-Exist which aims to optimize calculations. With this property, once a column in a table is filtered then the complete table is filtered inside the SUMMURIZECOLUMNS. This is why the slicer table must be different than the slicing by table in the table visual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still &lt;STRONG&gt;recommend&lt;/STRONG&gt; going for my &lt;STRONG&gt;first&lt;/STRONG&gt; solution where you have a &lt;STRONG&gt;Connectd&lt;/STRONG&gt; Brand Table. It is an extremely tiny table. Following this solution, the original report along with it's measure won't be affected at all and brand filter will continue working as normal.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Top 10 Products = 
VAR ProductValues = 
    CALCULATETABLE ( VALUES ( 'Sales'[ProductName] ), ALL ( 'Product' ) )
VAR SelectedProducts =
    CALCULATETABLE ( VALUES ( 'Sales'[ProductName] ), ALLSELECTED ( ) )
VAR Top5Selected = 
    TOPN ( 5, SelectedProducts, CALCULATE ( [Unit Sales], ALL ( 'Product'[BrandName] ) ) )
VAR AllNotSelected = 
    FILTER ( ALL ( 'Sales'[ProductName] ), NOT ( 'Sales'[ProductName] IN SelectedProducts ) )
VAR Top5AllNotSelected =
    CALCULATETABLE ( TOPN ( 5, AllNotSelected, [Unit Sales] ), ALL ( 'Product' ) )
VAR FilterTable = UNION ( Top5Selected, Top5AllNotSelected )
VAR Result =
        CALCULATE ( 
            [Unit Sales],
            ProductValues,
            FilterTable,
            ALL ( 'Product' )
        )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;Sample file here &lt;A href="https://we.tl/t-YhVPgZVAli" target="_blank"&gt;https://we.tl/t-YhVPgZVAli&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2023 09:54:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3099779#M108920</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-26T09:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: TOP N Products for Selected Brand and TOP N Products for All Other Brands</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3100001#M108948</link>
      <description>&lt;P&gt;Thank you for the thorough explanation. I will go with the table option.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2023 16:31:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TOP-N-Products-for-Selected-Brand-and-TOP-N-Products-for-All/m-p/3100001#M108948</guid>
      <dc:creator>msmays5</dc:creator>
      <dc:date>2023-02-26T16:31:54Z</dc:date>
    </item>
  </channel>
</rss>

