<?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: Issue with TOPN and RANKX with no ties in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917880#M95593</link>
    <description>&lt;P&gt;the code is used to create a new column. Are you creating a measure?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2022 07:22:29 GMT</pubDate>
    <dc:creator>FreemanZ</dc:creator>
    <dc:date>2022-11-21T07:22:29Z</dc:date>
    <item>
      <title>Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917776#M95582</link>
      <description>&lt;P&gt;I have a table visual and it has multiple columns present in it. I am trying to get the TOPN based on a particular column, even after there are no ties, it shows more than the required number. I have also used a RANKX function DAX but it has been returning 1 always.&lt;BR /&gt;&lt;BR /&gt;Measure&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RANKING = RANKX(ALL(Table Name), CALCULATE(SUM(Column Name(measure))). But it keeps throwing 1 itself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets say I have numbers below&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;H&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;Solid&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DEF&lt;/TD&gt;&lt;TD&gt;Liquid&lt;/TD&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;2%&lt;/TD&gt;&lt;TD&gt;456&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;GHI&lt;/TD&gt;&lt;TD&gt;Gas&lt;/TD&gt;&lt;TD&gt;23456&lt;/TD&gt;&lt;TD&gt;4%&lt;/TD&gt;&lt;TD&gt;789&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JKL&lt;/TD&gt;&lt;TD&gt;Solid&lt;/TD&gt;&lt;TD&gt;45678&lt;/TD&gt;&lt;TD&gt;5%&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the above example. Let me consider I want to calculate RANK for column E from the above table. But with the measure used I get Rank as 1 for all the rows i.e. Column H.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone provide me with a better solution? It happens for TOPN too even if there are no ties.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 06:39:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917776#M95582</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-21T06:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917836#M95588</link>
      <description>&lt;P&gt;Try to add a column with the code below:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;H =&lt;/DIV&gt;&lt;DIV&gt;RANKX(&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;ALL(TableName),&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;TableName[E],&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; DENSE&lt;BR /&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i tried and it works like this:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:07:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917836#M95588</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-21T07:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917863#M95592</link>
      <description>&lt;P&gt;If I am doing it without the aggregation on the TableName[E] then it shows me the following error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A single value for column ColumnName in Table TableName cannot be determined and not allowing me to move forward. However, if I am applying the aggregation it still shows RANK as 1 for all of the rows.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:16:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917863#M95592</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-21T07:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917880#M95593</link>
      <description>&lt;P&gt;the code is used to create a new column. Are you creating a measure?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:22:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917880#M95593</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-21T07:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917886#M95594</link>
      <description>&lt;P&gt;I am not creating a measure, it is an exisiting column, but if I am not using Aggregation DAX like SUM it gives me the above mentioned error.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:26:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917886#M95594</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-21T07:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917975#M95602</link>
      <description>&lt;P&gt;Sorry was unable to reply due to max limits on private message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the screenshot below for the measure I have generated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:55:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2917975#M95602</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-21T07:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2918154#M95613</link>
      <description>&lt;P&gt;have to see the names for the table and column. Could replace them with dummy code?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 09:04:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2918154#M95613</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-21T09:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with TOPN and RANKX with no ties</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2920949#M95790</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;The field &lt;STRONG&gt;[E]&lt;/STRONG&gt; is a fact field in the table or a measure? It is a measure, could you please provide its formula? Please create a &lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-measures#create-a-measure" target="_self"&gt;&lt;STRONG&gt;measure&lt;/STRONG&gt;&lt;/A&gt; as below and check if you can get the correct rank values...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;RANKING = RANKX ( ALLSELECTED ( 'Table' ), CALCULATE ( SUM ( 'Table'[E] ) ),,, DENSE )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;In addition, you can refer the following threads to solve your problem.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/RANKX-Always-Returns-1/m-p/146268" target="_self"&gt;&lt;SPAN&gt;RANKX Always Returns 1&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank Product =
RANKX (
    ALL ( MyData[Product] ),
    CALCULATE ( SUM ( MyData[Quantity] ), ALLEXCEPT ( MyData, MyData[Product] ) )
)&lt;/LI-CODE&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Rankx-all-return-1/m-p/47922" target="_self"&gt;&lt;SPAN&gt;Rankx all return 1&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total Sales = SUM ( sales[sales amount] )

SalesRank = RANKX ( ALLSELECTED ( sales[employee number] ), [Total Sales] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If the above one can't help you get the desired result, please provide some&amp;nbsp;&lt;STRONG&gt;raw(fake) data&lt;/STRONG&gt;&amp;nbsp;in your tables (&lt;STRONG&gt;&lt;I&gt;exclude&amp;nbsp;&lt;/I&gt;&lt;/STRONG&gt;&lt;EM&gt;&lt;STRONG&gt;sensitive&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt;&lt;I&gt;data&lt;/I&gt;&lt;/STRONG&gt;) with&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Text&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;format and your&amp;nbsp;&lt;STRONG&gt;expected result&lt;/STRONG&gt;&amp;nbsp;with backend logic and special examples.&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;SPAN&gt;It is better&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;if you can share a&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;&lt;SPAN&gt;simplified&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; box-sizing: border-box; font-variant-ligatures: normal; font-variant-caps: normal; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 08:37:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-TOPN-and-RANKX-with-no-ties/m-p/2920949#M95790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-22T08:37:06Z</dc:date>
    </item>
  </channel>
</rss>

