<?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 Power BI- TOPN with Others in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-TOPN-with-Others/m-p/2960709#M933</link>
    <description>&lt;H1&gt;Power BI TOPN +&amp;nbsp;Others&lt;/H1&gt;
&lt;FIGURE&gt;&lt;img /&gt;&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;FIGCAPTION&gt;Power Bi TOPN with&amp;nbsp;Others&lt;/FIGCAPTION&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Problem Statement: We would like to display the top 5 or the Top 10 with others. Other than the top 5/10 items, the rest are grouped into others.&lt;/P&gt;
&lt;P&gt;Solution: This solution requires us to use the extended dimension approach we have used in some of our previous blogs, such as &lt;A href="https://amitchandak.medium.com/power-bi-add-grand-total-row-in-the-bar-visual-44c3d1d463be" target="_blank" rel="noopener" data-href="https://amitchandak.medium.com/power-bi-add-grand-total-row-in-the-bar-visual-44c3d1d463be"&gt;showing the overall total on the bar visual&lt;/A&gt; and &lt;A href="https://amitchandak.medium.com/power-bi-show-unselected-values-as-others-7d4857b3ceab" target="_blank" rel="noopener" data-href="https://amitchandak.medium.com/power-bi-show-unselected-values-as-others-7d4857b3ceab"&gt;showing the unselected values as others&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;It is the standard sales model that I use for all my videos and blogs, and I am also using it for my YouTube channel. A sales fact that is joined with dimensions such as Item, Geography, Date, and Customer in addition to the key measure [net].&lt;/P&gt;
&lt;P&gt;The measure [NET] in the schema&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;net = [Gross] -[Discount]&lt;BR /&gt;Gross = Sum(Sales[Gross Sales Amount]) &lt;BR /&gt;Discount= Sum(Sales[Discount Amount])&lt;/PRE&gt;
&lt;P&gt;In order to display top brands alongside others, we will need an extended brand dimension. For this to be possible, we need to create a new table. To do this, we will use the following code to create a table&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Brand All = Union(  SUMMARIZE('Item','Item'[Brand], "All Brand", max('Item'[Brand])) ,&lt;BR /&gt;SUMMARIZE('Item','Item'[Brand], "All Brand", "Others")&lt;BR /&gt;)&lt;/PRE&gt;
&lt;P&gt;You can join it with the item dimension in the following way:&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Under the modeling tab, you can create a new numeric parameter by clicking on the new parameter button&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;It can be used to control TOPN as well as others. It will create a new table&amp;nbsp;&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Parameter = GENERATESERIES(0, 20, 1)&lt;/PRE&gt;
&lt;P&gt;Create a measure “Brand Rank”&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Rank Brand = rankx(ALLSELECTED('Brand All'[All Brand]), [Net])&lt;/PRE&gt;
&lt;P&gt;In order to be able to calculate the TOPN based on a parameter, we need a calculation that can give us that value&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;CALCULATE(sumx(filter(values( 'Brand All'[All Brand]) ,[Rank Brand] &amp;lt;= [Parameter Value]),[net]), 'Brand All'[All Brand] &amp;lt;&amp;gt; "Others")&lt;/PRE&gt;
&lt;P&gt;The final TOPN+Others measure will look like&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Topn + Other = &lt;BR /&gt;var _nother =  CALCULATE(sumx(filter(values( 'Brand All'[All Brand]) ,[Rank Brand] &amp;lt;= [Parameter Value]),[net]), 'Brand All'[All Brand] &amp;lt;&amp;gt; "Others")&lt;BR /&gt;return&lt;BR /&gt;if(ISINSCOPE('Brand All'[All Brand]), if([Rank Brand] &amp;lt;= [Parameter Value]+1, if(max('Brand All'[All Brand]) = "Others", [Net]- _nother,[Net]) , BLANK() ),[Net])&lt;/PRE&gt;
&lt;P&gt;Screenshots&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;You can find the file&amp;nbsp;attached below&lt;/P&gt;
&lt;P&gt;You can find the video below&lt;/P&gt;
&lt;FIGURE&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;div data-video-id="https://youtu.be/I_TY4hVlzAE" data-video-remote-vid="https://youtu.be/I_TY4hVlzAE" class="lia-video-container lia-media-is-center lia-media-size-large"&gt;&lt;iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FI_TY4hVlzAE%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DI_TY4hVlzAE&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FI_TY4hVlzAE%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" allowfullscreen="" style="max-width: 100%"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/FIGURE&gt;
&lt;P&gt;My Medium blog can be found &lt;A href="https://amitchandak.medium.com/" target="_blank" rel="noopener" data-href="https://amitchandak.medium.com/"&gt;here &lt;/A&gt;if you are interested&lt;/P&gt;
&lt;P&gt;Click &lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403"&gt;here&lt;/A&gt; to access all my blogs and videos in a jiffy via an exclusive glossary using Power BI. Please like, share, and comment on these blogs. I would appreciate your suggestions for improvement, challenges, and suggestions for topics so that I can explore these in more depth.&lt;/P&gt;
&lt;P&gt;In addition, I have over 500 videos on my &lt;A href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1" target="_blank" rel="noopener" data-href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1"&gt;YouTube channel&lt;/A&gt; that are related to Power BI, Tableau, and Incorta. With the help of these videos, you will learn hundreds of DAX and Power Query functions, in addition to hundreds of Power BI, use cases that will assist you in becoming an expert in Power BI. Make sure you &lt;A href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1"&gt;subscribe&lt;/A&gt;, like, and share it with your friends.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=wvsAzTqSDVg&amp;amp;list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=wvsAzTqSDVg&amp;amp;list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb"&gt;Master Power BI&lt;BR /&gt;&lt;/A&gt;&lt;A href="https://www.youtube.com/watch?v=59PUFuuCrbY&amp;amp;list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=59PUFuuCrbY&amp;amp;list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L"&gt;Expertise in Power BI&lt;BR /&gt;&lt;/A&gt;&lt;A href="https://www.youtube.com/watch?v=tAmg00Wf_cw&amp;amp;list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=tAmg00Wf_cw&amp;amp;list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54"&gt;Power BI For Tableau User&lt;BR /&gt;&lt;/A&gt;&lt;A href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj"&gt;DAX for SQL Users&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Dec 2022 06:07:14 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-12-11T06:07:14Z</dc:date>
    <item>
      <title>Power BI- TOPN with Others</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-TOPN-with-Others/m-p/2960709#M933</link>
      <description>&lt;H1&gt;Power BI TOPN +&amp;nbsp;Others&lt;/H1&gt;
&lt;FIGURE&gt;&lt;img /&gt;&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;FIGCAPTION&gt;Power Bi TOPN with&amp;nbsp;Others&lt;/FIGCAPTION&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Problem Statement: We would like to display the top 5 or the Top 10 with others. Other than the top 5/10 items, the rest are grouped into others.&lt;/P&gt;
&lt;P&gt;Solution: This solution requires us to use the extended dimension approach we have used in some of our previous blogs, such as &lt;A href="https://amitchandak.medium.com/power-bi-add-grand-total-row-in-the-bar-visual-44c3d1d463be" target="_blank" rel="noopener" data-href="https://amitchandak.medium.com/power-bi-add-grand-total-row-in-the-bar-visual-44c3d1d463be"&gt;showing the overall total on the bar visual&lt;/A&gt; and &lt;A href="https://amitchandak.medium.com/power-bi-show-unselected-values-as-others-7d4857b3ceab" target="_blank" rel="noopener" data-href="https://amitchandak.medium.com/power-bi-show-unselected-values-as-others-7d4857b3ceab"&gt;showing the unselected values as others&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;It is the standard sales model that I use for all my videos and blogs, and I am also using it for my YouTube channel. A sales fact that is joined with dimensions such as Item, Geography, Date, and Customer in addition to the key measure [net].&lt;/P&gt;
&lt;P&gt;The measure [NET] in the schema&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;net = [Gross] -[Discount]&lt;BR /&gt;Gross = Sum(Sales[Gross Sales Amount]) &lt;BR /&gt;Discount= Sum(Sales[Discount Amount])&lt;/PRE&gt;
&lt;P&gt;In order to display top brands alongside others, we will need an extended brand dimension. For this to be possible, we need to create a new table. To do this, we will use the following code to create a table&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Brand All = Union(  SUMMARIZE('Item','Item'[Brand], "All Brand", max('Item'[Brand])) ,&lt;BR /&gt;SUMMARIZE('Item','Item'[Brand], "All Brand", "Others")&lt;BR /&gt;)&lt;/PRE&gt;
&lt;P&gt;You can join it with the item dimension in the following way:&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;Under the modeling tab, you can create a new numeric parameter by clicking on the new parameter button&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;It can be used to control TOPN as well as others. It will create a new table&amp;nbsp;&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Parameter = GENERATESERIES(0, 20, 1)&lt;/PRE&gt;
&lt;P&gt;Create a measure “Brand Rank”&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Rank Brand = rankx(ALLSELECTED('Brand All'[All Brand]), [Net])&lt;/PRE&gt;
&lt;P&gt;In order to be able to calculate the TOPN based on a parameter, we need a calculation that can give us that value&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;CALCULATE(sumx(filter(values( 'Brand All'[All Brand]) ,[Rank Brand] &amp;lt;= [Parameter Value]),[net]), 'Brand All'[All Brand] &amp;lt;&amp;gt; "Others")&lt;/PRE&gt;
&lt;P&gt;The final TOPN+Others measure will look like&lt;/P&gt;
&lt;PRE spellcheck="false" data-code-block-mode="2" data-code-block-lang="cpp"&gt;Topn + Other = &lt;BR /&gt;var _nother =  CALCULATE(sumx(filter(values( 'Brand All'[All Brand]) ,[Rank Brand] &amp;lt;= [Parameter Value]),[net]), 'Brand All'[All Brand] &amp;lt;&amp;gt; "Others")&lt;BR /&gt;return&lt;BR /&gt;if(ISINSCOPE('Brand All'[All Brand]), if([Rank Brand] &amp;lt;= [Parameter Value]+1, if(max('Brand All'[All Brand]) = "Others", [Net]- _nother,[Net]) , BLANK() ),[Net])&lt;/PRE&gt;
&lt;P&gt;Screenshots&lt;/P&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;FIGURE&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/FIGURE&gt;
&lt;P&gt;You can find the file&amp;nbsp;attached below&lt;/P&gt;
&lt;P&gt;You can find the video below&lt;/P&gt;
&lt;FIGURE&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;div data-video-id="https://youtu.be/I_TY4hVlzAE" data-video-remote-vid="https://youtu.be/I_TY4hVlzAE" class="lia-video-container lia-media-is-center lia-media-size-large"&gt;&lt;iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FI_TY4hVlzAE%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DI_TY4hVlzAE&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FI_TY4hVlzAE%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" allowfullscreen="" style="max-width: 100%"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/FIGURE&gt;
&lt;P&gt;My Medium blog can be found &lt;A href="https://amitchandak.medium.com/" target="_blank" rel="noopener" data-href="https://amitchandak.medium.com/"&gt;here &lt;/A&gt;if you are interested&lt;/P&gt;
&lt;P&gt;Click &lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://community.powerbi.com/t5/Data-Stories-Gallery/Blog-Analysis/m-p/1265567#M4403"&gt;here&lt;/A&gt; to access all my blogs and videos in a jiffy via an exclusive glossary using Power BI. Please like, share, and comment on these blogs. I would appreciate your suggestions for improvement, challenges, and suggestions for topics so that I can explore these in more depth.&lt;/P&gt;
&lt;P&gt;In addition, I have over 500 videos on my &lt;A href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1" target="_blank" rel="noopener" data-href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1"&gt;YouTube channel&lt;/A&gt; that are related to Power BI, Tableau, and Incorta. With the help of these videos, you will learn hundreds of DAX and Power Query functions, in addition to hundreds of Power BI, use cases that will assist you in becoming an expert in Power BI. Make sure you &lt;A href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/c/Amitchandak?sub_confirmation=1"&gt;subscribe&lt;/A&gt;, like, and share it with your friends.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=wvsAzTqSDVg&amp;amp;list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=wvsAzTqSDVg&amp;amp;list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb"&gt;Master Power BI&lt;BR /&gt;&lt;/A&gt;&lt;A href="https://www.youtube.com/watch?v=59PUFuuCrbY&amp;amp;list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=59PUFuuCrbY&amp;amp;list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L"&gt;Expertise in Power BI&lt;BR /&gt;&lt;/A&gt;&lt;A href="https://www.youtube.com/watch?v=tAmg00Wf_cw&amp;amp;list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=tAmg00Wf_cw&amp;amp;list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54"&gt;Power BI For Tableau User&lt;BR /&gt;&lt;/A&gt;&lt;A href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj" target="_blank" rel="noopener ugc nofollow noopener" data-href="https://www.youtube.com/watch?v=WlvQ_SGy4iA&amp;amp;list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj"&gt;DAX for SQL Users&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Dec 2022 06:07:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-TOPN-with-Others/m-p/2960709#M933</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-12-11T06:07:14Z</dc:date>
    </item>
  </channel>
</rss>

