<?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: RANKX returns 1 for all ISO Codes in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-returns-1-for-all-ISO-Codes/m-p/3528818#M135596</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but can you try something like below if it works?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Test Ranking2 =
VAR test = Table[Slicer]
RETURN
    RANKX (
        ALL ( Table[IsoCode] ),
        CALCULATE (
            IF (
                CONTAINSSTRING ( test, "%" ),
                VALUE ( SUBSTITUTE ( test, "%", "" ) ),
                IF (
                    CONTAINSSTRING ( test, "$" ),
                    VALUE ( SUBSTITUTE ( test, "$", "" ) ),
                    BLANK ()
                )
            )
        ),
        ,
        ASC
    )
&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 11 Nov 2023 05:40:05 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2023-11-11T05:40:05Z</dc:date>
    <item>
      <title>RANKX returns 1 for all ISO Codes</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-returns-1-for-all-ISO-Codes/m-p/3528006#M135567</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Test Ranking2 = 

var test = Table[Slicer] 

var NumericValue =IF( CONTAINSSTRING(test, "%"), VALUE(SUBSTITUTE(test, "%", "")), IF (CONTAINSSTRING(test, "$"), VALUE(SUBSTITUTE(test, "$", "")), BLANK() )) 

return 

RANKX(FILTER(ALL(Table[IsoCode]), NumericValue), NumericValue,,ASC)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to rank ISO Code column based on value in Slicer. Slicer has both % and $ values based on selected column, so I created NumericValue variable to convert all values to type number and remove % or $ for calculation. My $ values are based on Sum of column grouped by ISO Code and % are based on Average of column grouped by ISO Code.&lt;/SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I tried different forms in expression field like :&lt;BR /&gt;1. returns 1 for all ISO Codes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MAXX(WinLossDataWithCountry,NumericValue) ​&lt;/LI-CODE&gt;&lt;P&gt;2. returns different numbers with duplicate ranking but giving value 10000 and 400 same rank. So its wrong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SUMX(WinLossDataWithCountry,NumericValue) ​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 15:24:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-returns-1-for-all-ISO-Codes/m-p/3528006#M135567</guid>
      <dc:creator>minnie_1</dc:creator>
      <dc:date>2023-11-10T15:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: RANKX returns 1 for all ISO Codes</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-returns-1-for-all-ISO-Codes/m-p/3528818#M135596</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but can you try something like below if it works?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Test Ranking2 =
VAR test = Table[Slicer]
RETURN
    RANKX (
        ALL ( Table[IsoCode] ),
        CALCULATE (
            IF (
                CONTAINSSTRING ( test, "%" ),
                VALUE ( SUBSTITUTE ( test, "%", "" ) ),
                IF (
                    CONTAINSSTRING ( test, "$" ),
                    VALUE ( SUBSTITUTE ( test, "$", "" ) ),
                    BLANK ()
                )
            )
        ),
        ,
        ASC
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 11 Nov 2023 05:40:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-returns-1-for-all-ISO-Codes/m-p/3528818#M135596</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-11-11T05:40:05Z</dc:date>
    </item>
  </channel>
</rss>

