<?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: FirstSortedValue Returns Null in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084116#M361014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting... that works like a charm, although QV doesn't seem to want to recognize that DISTINCT is valid for use in that expression.&amp;nbsp; Thanks, I knew it was probably something that simple!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jan 2016 16:44:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-01-13T16:44:10Z</dc:date>
    <item>
      <title>FirstSortedValue Returns Null</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084112#M361010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have looked at several threads about FirstSortedValue function and have followed the steps suggested in various scenarios, but for some reason I'm not always getting a value returned in my FirstSortedValue expression.&amp;nbsp; I have tried this both in the script and in the chart expression but nothing is resolving the issue.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario is this:&amp;nbsp; For each policy I have a field called StatusLabel that describes the status of the policy, and a SortID field that identifies how i want to sort the statuses.&amp;nbsp; For each customer, I want to return the FirstSortedValue of the StatusLabel sorted by SortID in reverse order (the highest numbered SortID).&amp;nbsp; My expression is:&lt;/P&gt;&lt;P&gt;FirstSortedValue(StatusLabel, -SortID)&lt;/P&gt;&lt;P&gt;Sometimes I get a value and sometimes I don't, and I can't figure out what the difference is.&amp;nbsp; I have attached a sample document that is filtered to a customer that clearly has several policies of varying statuses associated, but the FirstSortedValue function is not returning a value either in the script by returning a value in the PersonStatus field, or in the chart expression where I tested it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone see what I'm missing?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:35:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084112#M361010</guid>
      <dc:creator />
      <dc:date>2016-01-13T16:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue Returns Null</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084113#M361011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue(DISTINCT StatusLabel, -SortID)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:38:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084113#M361011</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-01-13T16:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue Returns Null</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084114#M361012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are using a field which isn't even available in your database -&amp;gt; Rank. What is your expected Status from these and what is the logic?&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/111525_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:39:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084114#M361012</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-13T16:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue Returns Null</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084115#M361013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, i changed the name for the field Rank to 'SortID' in the script thinking maybe the issue was that I used a QV keyword as a field name.&amp;nbsp; I forgot to update that expression to use the revised field name before i saved and uploaded the sample doc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:42:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084115#M361013</guid>
      <dc:creator />
      <dc:date>2016-01-13T16:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue Returns Null</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084116#M361014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting... that works like a charm, although QV doesn't seem to want to recognize that DISTINCT is valid for use in that expression.&amp;nbsp; Thanks, I knew it was probably something that simple!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:44:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084116#M361014</guid>
      <dc:creator />
      <dc:date>2016-01-13T16:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue Returns Null</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084117#M361015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, the Rank field is&amp;nbsp; been renamed in the script to SortID. So in object CH03 you have to change the -Rank to -SortID. Now it should read FirstSortedValue(StatusLabel, -SortID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, some customer ID is frequency count is more than 1. So whenever Customer ID frequency count is more than 1 FirstSortedValue will return Null value '(-)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be use this&lt;/P&gt;&lt;P&gt;FirstSortedValue(DISTINCT StatusLabel, -SortID)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:48:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-Returns-Null/m-p/1084117#M361015</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2016-01-13T16:48:36Z</dc:date>
    </item>
  </channel>
</rss>

