<?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: Problem with FirstSortedValue when dealing with repeated values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331869#M823409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fist text box&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(col1,aggr(sum(col3),col2,col1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;second text box&lt;/P&gt;&lt;P&gt;FirstSortedValue(col3,-aggr(sum(col3),col2,col1))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Aug 2017 07:43:39 GMT</pubDate>
    <dc:creator>arulsettu</dc:creator>
    <dc:date>2017-08-02T07:43:39Z</dc:date>
    <item>
      <title>Problem with FirstSortedValue when dealing with repeated values</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331868#M823408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have a problem with FirstSortedValue. Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;temp:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;load * inline&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;col1, col2, col3&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;1, a1, 1000&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;2,c1, 2000&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;3, b1, 3000&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;3,b1,4000&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;];&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;I have data as above. And in a text box I have =FirstSortedValue( col2, -col1), The result i want is b1 but it does not work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;In another box I have &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=FirstSortedValue( col3, -col1), The result I want is 3000, 4000 but it does not work either.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Can anybody help me? Thank you in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Junfei&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331868#M823408</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FirstSortedValue when dealing with repeated values</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331869#M823409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fist text box&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(col1,aggr(sum(col3),col2,col1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;second text box&lt;/P&gt;&lt;P&gt;FirstSortedValue(col3,-aggr(sum(col3),col2,col1))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 07:43:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331869#M823409</guid>
      <dc:creator>arulsettu</dc:creator>
      <dc:date>2017-08-02T07:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FirstSortedValue when dealing with repeated values</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331870#M823410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Exp1: &lt;EM&gt;=FirstSortedValue(DISTINCT col2, -col1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Exp2: =FirstSortedValue(Aggr(concat(DISTINCT col3, ','), col1), -Aggr(col1,col1))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/172157_Capture.PNG" style="height: auto;" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 07:51:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331870#M823410</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2017-08-02T07:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FirstSortedValue when dealing with repeated values</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331871#M823411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Junfei,&lt;/P&gt;&lt;P&gt;Here's an alternative for your second expression. I dislike FirstSortedValue because of the way it treats ties for the place in the ranking we're looking for&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concat(Aggr(if(Rank(sum(col1)) =1, col3),col3),',') = 3000,4000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 08:30:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331871#M823411</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2017-08-02T08:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FirstSortedValue when dealing with repeated values</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331872#M823412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your expression is correct, but you just need to add Distinct keyword as you have multiple value for max of col1&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;FirstSortedValue(&lt;STRONG&gt;DISTINCT&lt;/STRONG&gt; col2, -col1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;for second expression you can use the below instead of complex firstsortedvalue function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=Concat({&amp;lt;col1={"$(=max(col1))"}&amp;gt;}col3,',')&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Aug 2017 12:31:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331872#M823412</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2017-08-02T12:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FirstSortedValue when dealing with repeated values</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331873#M823413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use distinct qualifier in your firstsortedvalue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(&lt;STRONG&gt;distinct&lt;/STRONG&gt; col2,-col1)&lt;/P&gt;&lt;P&gt;FirstSortedValue(&lt;STRONG&gt;distinct&lt;/STRONG&gt; col3, -col1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Aug 2017 11:37:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-FirstSortedValue-when-dealing-with-repeated-values/m-p/1331873#M823413</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2017-08-03T11:37:12Z</dc:date>
    </item>
  </channel>
</rss>

