<?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 How to rank an expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232601#M84203</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Kevin!&lt;/P&gt;&lt;P&gt;Your expression works well! I've tried something like that this morning...I had got the idea of recursion, but the expression I've wrote fault and so I've tought that qlikview doesn't support recursion in expressions...but your example showes me simply that I make some mistakes writing the expression.&lt;/P&gt;&lt;P&gt;Thank you a lot for your help!&lt;/P&gt;&lt;P&gt;I've another question. The expression you suggest works only on ordered table, do you know a way to modify the expression so that works on not ordered tables?&lt;/P&gt;&lt;P&gt;I ask that because of in my project I've a lot of ranking on the same table. The table header looks like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dimension exp exp1 exp2 exp3 myRank1,myRank2,myRank3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Where myRank1 ranking on exp1, myRank2 on exp2 and so on...&lt;/P&gt;&lt;P&gt;Have you got some idee to solve this problem too?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thaks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matteo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jul 2010 13:29:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-26T13:29:17Z</dc:date>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232594#M84196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've a straight table with one dimension,and two expressions (one of which is a rank expression) like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DIM EXP RANK(EXP)&lt;/P&gt;&lt;P&gt;A 10 1&lt;/P&gt;&lt;P&gt;B 20 2&lt;/P&gt;&lt;P&gt;C 20 2&lt;/P&gt;&lt;P&gt;D 30 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need another way to display the RANK(EXP), I mut use this expression as base for others computation and so I need to associate ad the element D the value 3 ( the 3td value in the sequence) and not 4 as in the example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result I want looks like this:&lt;/P&gt;&lt;P&gt;DIM EXP RANK(EXP)&lt;/P&gt;&lt;P&gt;A 10 1&lt;/P&gt;&lt;P&gt;B 20 2&lt;/P&gt;&lt;P&gt;C 20 2&lt;/P&gt;&lt;P&gt;D 30 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thak you for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 15:07:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232594#M84196</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-23T15:07:19Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232595#M84197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;You can change the way the rank function handles equal ranking using an additional parameter, however, it doesn't appear that any of the options presented will resolve your issue the way you describe.&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;Technically, B and C are both ranked 2 and 3, but they share the 2 ranking as a result of how QV handles rank.&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;If you did Rank(Exp, 4) You'd get closest, which would give you:&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="background:#dddddd;"&gt;DIM EXP RANK(EXP)&lt;/P&gt;&lt;P style="background:#dddddd;"&gt;A 10 1&lt;/P&gt;&lt;P style="background:#dddddd;"&gt;B 20 2&lt;/P&gt;&lt;P style="background:#dddddd;"&gt;C 20 3&lt;/P&gt;&lt;P style="background:#dddddd;"&gt;D 30 4&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;Depending on your calculation, average rank might also be a better option.&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;The help files do a reasonably good job of explaining the 'rank' function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 23:30:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232595#M84197</guid>
      <dc:creator />
      <dc:date>2010-07-23T23:30:02Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232596#M84198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To Ryan's point, what you request is not quite "Rank", it's a modified version of it. One way to calculate it could be using function above() and comparing the values manually:&lt;/P&gt;&lt;P&gt;Expression1 = Exp, Expression 2= Rank:&lt;/P&gt;&lt;P&gt;if( rowno() = 1, 1,&lt;/P&gt;&lt;P&gt;if( above(Exp) &amp;lt; Exp, above(Rank), Rank))&lt;/P&gt;&lt;P&gt;If the table is very large, this might be heavy...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV id="refHTML"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jul 2010 16:38:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232596#M84198</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-07-24T16:38:19Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232597#M84199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That expression is close, but does not work without minor modification:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;if( rowno() = 1, 1,&lt;BR /&gt;&lt;BR /&gt; if( above([EXP]) &amp;lt; [EXP], above([RANK])+1, above([RANK])))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;This accomplishes what you are after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Jul 2010 07:38:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232597#M84199</guid>
      <dc:creator />
      <dc:date>2010-07-25T07:38:21Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232598#M84200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Kevin, that;s exactly what I meant, just managed to confuse myself with my own logic... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV id="refHTML"&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 Jul 2010 19:48:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232598#M84200</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-07-25T19:48:23Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232599#M84201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tanks to all for the replies!&lt;/P&gt;&lt;P&gt;I've tried yours expressions..I have a result cose what I want,but there are some errors:&lt;/P&gt;&lt;P&gt;The expression I've use is:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if( [Rank] = 1, 1,&lt;BR /&gt; if( above([Exp]) &amp;gt; [Exp], above([Rank])+1, above([Rank])&lt;BR /&gt; ))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Where I've sobstituded the rowno() function with the [Rank] result because of the table maybe not ordered (I can have moltiple ranking on a table....).&lt;/P&gt;&lt;P&gt;I've defined two main expressions (Exp and Rank) as suggested by Oleg.&lt;/P&gt;&lt;P&gt;Exp-&amp;gt; The main expression (something like sum(....))&lt;/P&gt;&lt;P&gt;Rank-&amp;gt; The base rank expression (something linke Rank(Exp))&lt;/P&gt;&lt;P&gt;And at the end I've defined the "custom" rank expression suggested by Oleg and described above.&lt;/P&gt;&lt;P&gt;The expression faults when after a sequence of elements at the same rank, I have stored the results in a excel file I've attached.&lt;/P&gt;&lt;P&gt;The first column is the dimension, than the Exp, the Rank and the result of the "Costum rank". I've lighted in yellow where the expression faults and I've manually added a column that represent the result I'm looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank to all for your help! I hope we can solve this question...there are some days I'm thinking about it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 08:29:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232599#M84201</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-26T08:29:34Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232600#M84202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have attached a QVW here. I have loaded in your spreadsheet as source data and recreated the straight table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two different slight variations of the expression in the table, and they both are giving the correct order...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expressions used are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if( rowno() = 1, 1, if( [EXP] = above([EXP]), above([MyRank]), above([MyRank]) + 1 ))&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;if( rowno() = 1, 1, if( above([EXP]) &amp;gt; ([EXP]), above([RANK])+1, above([RANK]) ))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 12:51:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232600#M84202</guid>
      <dc:creator />
      <dc:date>2010-07-26T12:51:01Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232601#M84203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Kevin!&lt;/P&gt;&lt;P&gt;Your expression works well! I've tried something like that this morning...I had got the idea of recursion, but the expression I've wrote fault and so I've tought that qlikview doesn't support recursion in expressions...but your example showes me simply that I make some mistakes writing the expression.&lt;/P&gt;&lt;P&gt;Thank you a lot for your help!&lt;/P&gt;&lt;P&gt;I've another question. The expression you suggest works only on ordered table, do you know a way to modify the expression so that works on not ordered tables?&lt;/P&gt;&lt;P&gt;I ask that because of in my project I've a lot of ranking on the same table. The table header looks like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dimension exp exp1 exp2 exp3 myRank1,myRank2,myRank3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Where myRank1 ranking on exp1, myRank2 on exp2 and so on...&lt;/P&gt;&lt;P&gt;Have you got some idee to solve this problem too?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thaks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matteo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 13:29:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232601#M84203</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-26T13:29:17Z</dc:date>
    </item>
    <item>
      <title>How to rank an expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232602#M84204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; What version of QlikView are you using?&amp;nbsp; I am on v9r7 and the 'above' function does not want to work for me.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2011 22:23:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-rank-an-expression/m-p/232602#M84204</guid>
      <dc:creator />
      <dc:date>2011-06-09T22:23:41Z</dc:date>
    </item>
  </channel>
</rss>

