<?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 Function need desired output in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840855#M295517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Help me out in getting desired output.&amp;nbsp; I am trying to get ranking to aggregated data. One expression is giving wrong output please find the yellow marked column in&amp;nbsp; output and expected output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Output.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92391_Output.PNG" style="height: auto; max-width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 9pt; font-family: 'Arial',sans-serif;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Aggr(Sum([Value]), Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggr(FirstSortedValue(Name, -aggr(max(Value),Agent,Comtype,POS,OD,Name)), Agent,Comtype,POS,OD)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(max(Value),Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #800000;"&gt;Aggr(FirstSortedValue(Name, -aggr(max(Value,2),Agent,Comtype,POS,OD)), Agent,Comtype,POS,OD) &lt;SPAN style="color: #0000ff;"&gt;(this is the expression &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #0000ff;"&gt;giving wrong output.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(max(Value,2),Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggr(FirstSortedValue(Name, -aggr(max(Value,3),Agent,Comtype,POS,OD)), Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(max(Value,3),Agent,Comtype,POS,OD)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jul 2015 12:56:23 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-07-09T12:56:23Z</dc:date>
    <item>
      <title>Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840855#M295517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Help me out in getting desired output.&amp;nbsp; I am trying to get ranking to aggregated data. One expression is giving wrong output please find the yellow marked column in&amp;nbsp; output and expected output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Output.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92391_Output.PNG" style="height: auto; max-width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 9pt; font-family: 'Arial',sans-serif;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Aggr(Sum([Value]), Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggr(FirstSortedValue(Name, -aggr(max(Value),Agent,Comtype,POS,OD,Name)), Agent,Comtype,POS,OD)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(max(Value),Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #800000;"&gt;Aggr(FirstSortedValue(Name, -aggr(max(Value,2),Agent,Comtype,POS,OD)), Agent,Comtype,POS,OD) &lt;SPAN style="color: #0000ff;"&gt;(this is the expression &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #0000ff;"&gt;giving wrong output.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(max(Value,2),Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggr(FirstSortedValue(Name, -aggr(max(Value,3),Agent,Comtype,POS,OD)), Agent,Comtype,POS,OD) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(max(Value,3),Agent,Comtype,POS,OD)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 12:56:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840855#M295517</guid>
      <dc:creator />
      <dc:date>2015-07-09T12:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840856#M295518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your firstsortedvalue is looking wrong... use as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(Name, -aggr(max(Value),Agent,Comtype,POS,OD,Name),2)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:07:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840856#M295518</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-07-09T13:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840857#M295519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to stick with FirstSortedValue(), maybe like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue( Name, -aggr(sum(Value),Agent,Comtype,POS,OD,Name),2)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:08:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840857#M295519</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-09T13:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840858#M295520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Manish, I tried doing this, but it doesn't give correct output for two rows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92395_Capture.PNG" style="height: 102px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/92402_Capture.PNG" style="height: 376px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to handle this with FirstSortedValue() still?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/15823"&gt;swuehl&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:15:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840858#M295520</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-07-09T13:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840859#M295521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="Capture2.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92397_Capture2.PNG" style="width: 620px; height: 266px;" /&gt;&lt;/P&gt;&lt;P&gt;Thank You all ............Still getting error not getting desired output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:16:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840859#M295521</guid>
      <dc:creator />
      <dc:date>2015-07-09T13:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840860#M295522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue( Name, -aggr(Value, Agent,Comtype,POS,OD,Value,Name),2)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:27:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840860#M295522</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-09T13:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840861#M295523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:29:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840861#M295523</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-07-09T13:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840862#M295524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent Bro ..........Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:33:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840862#M295524</guid>
      <dc:creator />
      <dc:date>2015-07-09T13:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Function need desired output</title>
      <link>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840863#M295525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi shyamkb18,&lt;/P&gt;&lt;P&gt;sorry to say that, but for me it looks like your data is kind of contradictory:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="AirIndia.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92410_AirIndia.jpg" style="height: 238px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;e.g. for Agent B Business Class BLR with DEL-JP the name F1 has value 50 and 200 in week 1!?!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do the changes like this:&lt;BR /&gt;&lt;IMG alt="AirIndia2.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/92411_AirIndia2.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your original expression is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Burkhard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 14:43:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Rank-Function-need-desired-output/m-p/840863#M295525</guid>
      <dc:creator>veidlburkhard</dc:creator>
      <dc:date>2015-07-09T14:43:50Z</dc:date>
    </item>
  </channel>
</rss>

