<?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: How to get rank() functionality in Qlik code in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952430#M78531</link>
    <description>&lt;P&gt;There is a Rank() function in the Qlik engine, and it works fine in charts. Calculating the rank in the UI has the advantage that the number is then dynamic - it is calculated according your current selection.&lt;/P&gt;&lt;P&gt;But you seem to want to use a Rank() function in the Load script, where there is no Rank() function. The work-around is to load the rank using a combination of RecNo() and Order By.&amp;nbsp; Say that you want to rank the customers according to their Sum(SalesAmount). Then you can do this by using something like&lt;/P&gt;&lt;P&gt;tmp:&lt;BR /&gt;Load Customer, Sum(SalesAmount) as SumOfSales Resident FactTable Group By Customer;&lt;/P&gt;&lt;P&gt;Rank:&lt;BR /&gt;Load Customer, RecNo() as Rank Resident tmp Order By SumOfSales Desc;&lt;/P&gt;&lt;P&gt;Drop Table tmp;&lt;/P&gt;&lt;P&gt;But this will be a static ranking. If you want to have it dynamic, you need to calculate the rank in the UI.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2022 14:28:18 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2022-07-06T14:28:18Z</dc:date>
    <item>
      <title>How to get rank() functionality in Qlik code</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952303#M78511</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I have sql data like.&lt;/P&gt;
&lt;P&gt;SELECT period_id, &lt;BR /&gt;week_ending_date,&lt;BR /&gt;trimester_of_year_cal,&lt;BR /&gt;Rank() &lt;BR /&gt;OVER ( &lt;BR /&gt;ORDER BY week_ending_date DESC) AS rnk&lt;BR /&gt;FROM $(v_Revised_Dremio_Path)VDS_dim_period &lt;BR /&gt;WHERE dlevel = 'W';&lt;/P&gt;
&lt;P&gt;How to get rank functionality from the above sql code in qlikview code.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 10:45:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952303#M78511</guid>
      <dc:creator>Naps_230</dc:creator>
      <dc:date>2022-07-06T10:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rank() functionality in Qlik code</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952427#M78530</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/18129"&gt;@Naps_230&lt;/a&gt;&amp;nbsp;We do not have direct rank function in the Script. So you could follow something like below in your script. Assuming your data is already loaded in table name Main.&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;Load&amp;nbsp;&lt;SPAN&gt;period_id,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;week_ending_date,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;trimester_of_year_cal,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Autonumber(&lt;SPAN&gt;week_ending_date&lt;/SPAN&gt;) as Rank&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Resident Main&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WHERE dlevel = 'W'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Order by&amp;nbsp;week_ending_date desc ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 14:21:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952427#M78530</guid>
      <dc:creator>sidhiq91</dc:creator>
      <dc:date>2022-07-06T14:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rank() functionality in Qlik code</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952430#M78531</link>
      <description>&lt;P&gt;There is a Rank() function in the Qlik engine, and it works fine in charts. Calculating the rank in the UI has the advantage that the number is then dynamic - it is calculated according your current selection.&lt;/P&gt;&lt;P&gt;But you seem to want to use a Rank() function in the Load script, where there is no Rank() function. The work-around is to load the rank using a combination of RecNo() and Order By.&amp;nbsp; Say that you want to rank the customers according to their Sum(SalesAmount). Then you can do this by using something like&lt;/P&gt;&lt;P&gt;tmp:&lt;BR /&gt;Load Customer, Sum(SalesAmount) as SumOfSales Resident FactTable Group By Customer;&lt;/P&gt;&lt;P&gt;Rank:&lt;BR /&gt;Load Customer, RecNo() as Rank Resident tmp Order By SumOfSales Desc;&lt;/P&gt;&lt;P&gt;Drop Table tmp;&lt;/P&gt;&lt;P&gt;But this will be a static ranking. If you want to have it dynamic, you need to calculate the rank in the UI.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 14:28:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-rank-functionality-in-Qlik-code/m-p/1952430#M78531</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2022-07-06T14:28:18Z</dc:date>
    </item>
  </channel>
</rss>

