<?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 RANK indexing with condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727690#M181107</link>
    <description>&lt;P&gt;Hi, have been looking at indexing again, and whether some sequencing conditions would be achievable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For&amp;nbsp; (see snip below):&lt;BR /&gt;RAND = RAND()&lt;BR /&gt;RANK = RANKX(ALL(Table),Table[RAND])&lt;BR /&gt;RANK INC = IF(Table[isCurrent]="No",RANKX(ALL(Table),Table[RAND]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to in the RANK INC not have it skip the excluded numbers and keep the sequence running without number gaps.&lt;BR /&gt;Thought about &amp;amp;&amp;amp; Table[isCurrent]="No" in RANK but can't get it right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or is RANKX not going to be the best option to fulfil?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Separately, I was then working on 3 digits to make up the number in RANK INC to be a full 3 digit sequence with leading zeroes.&lt;BR /&gt;Still learning switch but would switch enable length decision and prefix 00 (for 1), 0 (for 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jun 2025 19:21:23 GMT</pubDate>
    <dc:creator>JK-1</dc:creator>
    <dc:date>2025-06-10T19:21:23Z</dc:date>
    <item>
      <title>RANK indexing with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727690#M181107</link>
      <description>&lt;P&gt;Hi, have been looking at indexing again, and whether some sequencing conditions would be achievable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For&amp;nbsp; (see snip below):&lt;BR /&gt;RAND = RAND()&lt;BR /&gt;RANK = RANKX(ALL(Table),Table[RAND])&lt;BR /&gt;RANK INC = IF(Table[isCurrent]="No",RANKX(ALL(Table),Table[RAND]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to in the RANK INC not have it skip the excluded numbers and keep the sequence running without number gaps.&lt;BR /&gt;Thought about &amp;amp;&amp;amp; Table[isCurrent]="No" in RANK but can't get it right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or is RANKX not going to be the best option to fulfil?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Separately, I was then working on 3 digits to make up the number in RANK INC to be a full 3 digit sequence with leading zeroes.&lt;BR /&gt;Still learning switch but would switch enable length decision and prefix 00 (for 1), 0 (for 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 19:21:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727690#M181107</guid>
      <dc:creator>JK-1</dc:creator>
      <dc:date>2025-06-10T19:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: RANK indexing with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727728#M181108</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="927611" data-lia-user-login="JK-1" class="lia-mention lia-mention-user"&gt;JK-1&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Please try the following DAX calculated column and let me know if this achieves your desired result. This also takes into account your 3 digit formatting:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;RANK INC = 
IF(
    Table[isCurrent] = "No",
    FORMAT(
        RANKX(
            FILTER(ALL(Table), Table[isCurrent] = "No"),
            Table[RAND],
            ,
            ASC,
            DENSE
        ),
        "000"
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Samson&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Connect with me on &lt;/STRONG&gt;&lt;A href="https://www.linkedin.com/in/samson-truong/" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;LinkedIn&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Check out my &lt;/STRONG&gt;&lt;A href="https://discoveringallthingsanalytics.com/" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;Blog&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Going to the European Microsoft Fabric Community Conference? Check out my &lt;/STRONG&gt;&lt;A href="https://www.sharepointeurope.com/events/semantic-model-optimization-for-enterprise-ai-enablement/" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;Session&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 20:08:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727728#M181108</guid>
      <dc:creator>SamsonTruong</dc:creator>
      <dc:date>2025-06-10T20:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: RANK indexing with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727869#M181112</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="3394" data-lia-user-login="JK" class="lia-mention lia-mention-user"&gt;JK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please try below DAX expresion:&lt;BR /&gt;RANK_INC_Formatted =&lt;BR /&gt;VAR RankValue =&lt;BR /&gt;RANKX(&lt;BR /&gt;FILTER(ALL(Table), Table[isCurrent] = "No"),&lt;BR /&gt;Table[RAND],&lt;BR /&gt;,&lt;BR /&gt;ASC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;Table[isCurrent] = "No",&lt;BR /&gt;FORMAT(RankValue, "000")&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FILTER(ALL(Table), Table[isCurrent] = "No") ==&amp;gt; ensures only those rows are considered.&lt;BR /&gt;DENSE&amp;nbsp;ranking avoids gaps&amp;nbsp; ==&amp;gt; 1,2 ,3 ...&lt;BR /&gt;FORMAT function with "000" to add the number with leading zeros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you have further questions.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too.&amp;nbsp;And if you found it useful, a quick "Kudos" is always appreciated, thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maruthi&amp;nbsp;&lt;/P&gt;&lt;P&gt;LinkedIn -&amp;nbsp;&lt;A href="http://www.linkedin.com/in/maruthi-siva-prasad/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.linkedin.com/in/maruthi-siva-prasad/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&lt;A href="https://x.com/maruthisp" rel="nofollow noopener noreferrer" target="_blank"&gt;Maruthi Siva Prasad - (@MaruthiSP) / X&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 01:48:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4727869#M181112</guid>
      <dc:creator>maruthisp</dc:creator>
      <dc:date>2025-06-11T01:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: RANK indexing with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4728009#M181119</link>
      <description>&lt;P&gt;Thankyou,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="927426" data-lia-user-login="SamsonTruong" class="lia-mention lia-mention-user"&gt;SamsonTruong&lt;/a&gt; and&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="526044" data-lia-user-login="maruthisp" class="lia-mention lia-mention-user"&gt;maruthisp&lt;/a&gt;, for your response.&lt;BR /&gt;&lt;BR /&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="927611" data-lia-user-login="JK-1" class="lia-mention lia-mention-user"&gt;JK-1&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your inquiry posted on the Microsoft Fabric Community Forum.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;It is possible to achieve gapless ranking for only the rows with "No" using the RANKX function, and to format these rankings as three-digit strings using the FORMAT function.&lt;/P&gt;
&lt;P&gt;Kindly find attached a screenshot and the PBIX file, which may assist in resolving the issue:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you find our response helpful, we would be grateful if you could mark it as the accepted solution and kindly provide kudos. This will help other members of the community who may have similar queries.&lt;/P&gt;
&lt;P&gt;Should you have any further questions, please feel free to reach out to the Microsoft Fabric Community.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 05:02:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4728009#M181119</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-06-11T05:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: RANK indexing with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4729196#M181158</link>
      <description>&lt;P&gt;That is excellent, thank you. Especially handy capturing the other part within it.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 21:08:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANK-indexing-with-condition/m-p/4729196#M181158</guid>
      <dc:creator>JK-1</dc:creator>
      <dc:date>2025-06-11T21:08:04Z</dc:date>
    </item>
  </channel>
</rss>

