<?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: Index column without sorting in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1008973#M12880</link>
    <description>&lt;P&gt;You will need a column that can be ordered. Otherwise, there is no way for DAX to count up in terms of how many rows into the dataset it is. If you do not have this, just add an Index column in Power Query. If you had that, it becomes simply a matter of using DAX Index = COUNTROWS(FILTER('Table',[Index]&amp;lt;EARLIER([Index]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, if you already have it...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, if you add color, you can do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAX Index 2 =&amp;nbsp;COUNTROWS(FILTER('Table',[Index]&amp;lt;EARLIER([Index]) &amp;amp;&amp;amp; [Color] = EARLIER([Color]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might find this entertaining:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Apr 2020 02:25:16 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2020-04-06T02:25:16Z</dc:date>
    <item>
      <title>Index column without sorting</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1008744#M12870</link>
      <description>&lt;P&gt;Is it possible with dax to create a custom column with an index (basically a row number), I need not to rank by a column and mantain the order passed by the DB.&lt;/P&gt;&lt;P&gt;Is then possible in the same order to calculate another Index that starts from 1 for each type of literal description in a column? (eg. Red, Green, Blue)&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 18:16:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1008744#M12870</guid>
      <dc:creator>AGo</dc:creator>
      <dc:date>2020-04-05T18:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Index column without sorting</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1008973#M12880</link>
      <description>&lt;P&gt;You will need a column that can be ordered. Otherwise, there is no way for DAX to count up in terms of how many rows into the dataset it is. If you do not have this, just add an Index column in Power Query. If you had that, it becomes simply a matter of using DAX Index = COUNTROWS(FILTER('Table',[Index]&amp;lt;EARLIER([Index]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, if you already have it...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, if you add color, you can do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAX Index 2 =&amp;nbsp;COUNTROWS(FILTER('Table',[Index]&amp;lt;EARLIER([Index]) &amp;amp;&amp;amp; [Color] = EARLIER([Color]))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might find this entertaining:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 02:25:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1008973#M12880</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-04-06T02:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Index column without sorting</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1009517#M12887</link>
      <description>&lt;P&gt;Ok, so for DAX is impossible to add an index column in the original order of the query, the only way is using power query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 09:14:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Index-column-without-sorting/m-p/1009517#M12887</guid>
      <dc:creator>AGo</dc:creator>
      <dc:date>2020-04-06T09:14:25Z</dc:date>
    </item>
  </channel>
</rss>

