<?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: TopN - User selects N in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2263356#M54781</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you mind sharing your sample data (with sensitive information removed) in a way that is not an image so that we can better help you?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_self"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Community Support Team _ Caitlyn&lt;/P&gt;
&lt;P&gt;If this post helps then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 09:09:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-01-03T09:09:54Z</dc:date>
    <item>
      <title>TopN - User selects N</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261358#M54692</link>
      <description>&lt;P&gt;Good Morning!&lt;/P&gt;&lt;P&gt;I am trying to create a table that shows the sales of Top N stores.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;User selects N - via clicking on a value (e.g., 1, 3, 5, 10, ...) in a slicer / 1 col table i have created - SelectNumber[Select Number]&lt;/P&gt;&lt;P&gt;Below is my Dax -&amp;nbsp; using SelectedValue does not work; if i give it a number like 3 or 4, it works.&amp;nbsp; I also tried calculate Max - did not work either.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest.&lt;/P&gt;&lt;P&gt;Thanks!, Pavan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TopStores = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;RowCountbyUser&lt;/SPAN&gt;&lt;SPAN&gt; = SelectedValue('SelectNumber'[Select Number])) --&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt; &lt;SPAN&gt;-- Calculate(Max('SelectNumber'[Select Number])) --&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TOPN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;RowCountbyUser&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;--TOPN(SelectedValue('SelectNumber'[Select Number]), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'StoreSales'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'StoreSales'[Region]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'StoreSales'[State]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'StoreSales'[Location]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'StoreSales'[Store Type]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'StoreSales'[Volume Cluster]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'StoreSales'[Internal Net Sales]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'StoreSales'[Internal Net Sales]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Desc&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 Dec 2021 16:15:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261358#M54692</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-30T16:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: TopN - User selects N</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261367#M54694</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , you need only TOPN stores?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Top 10 by duration = calculate(Sum(Table[Value]),TOPN(10,allselected(table[Store]),[Total Duration],DESC), values(table[Store]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 16:20:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261367#M54694</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-30T16:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: TopN - User selects N</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261370#M54695</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;SELECTEDVALUE will not work if you choose more than one item in the slicer. You could use MAX('SelectNumber'[SelectNumber]) instead.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 16:23:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261370#M54695</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-12-30T16:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: TopN - User selects N</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261382#M54696</link>
      <description>&lt;P&gt;Thanks Amit.&lt;/P&gt;&lt;P&gt;Table pic and slicer / user selection pic attached below.&amp;nbsp;&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;</description>
      <pubDate>Thu, 30 Dec 2021 16:37:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261382#M54696</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-30T16:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: TopN - User selects N</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261385#M54697</link>
      <description>&lt;P&gt;Thanks Greg.&lt;/P&gt;&lt;P&gt;User can only select 1 value.&amp;nbsp; I tried Max as well.&amp;nbsp; Did not work.&lt;/P&gt;&lt;P&gt;Pic attached below.&amp;nbsp;&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;</description>
      <pubDate>Thu, 30 Dec 2021 16:38:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2261385#M54697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-30T16:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: TopN - User selects N</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2263356#M54781</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you mind sharing your sample data (with sensitive information removed) in a way that is not an image so that we can better help you?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_self"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Community Support Team _ Caitlyn&lt;/P&gt;
&lt;P&gt;If this post helps then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 09:09:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/TopN-User-selects-N/m-p/2263356#M54781</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-03T09:09:54Z</dc:date>
    </item>
  </channel>
</rss>

