<?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 and AGGR in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000719#M340184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gabriel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Short_Reference is a string. Max(Short_Reference) won't work, and MaxString would give me, for example, the Ref that starts with "ZZ", which is not what I want. I want the REF with the latest date attached. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks, Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Dec 2015 14:41:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-12-11T14:41:41Z</dc:date>
    <item>
      <title>FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000715#M340180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am trying to find the last time our reps made contact with the customer and what they entered in the "REF" field. The relevant fields in my table are Sales_Rep, Short_Reference, and RefDate (MM/DD/YY hh:mm). When I put in the RESULT CODE as a dimension, I get the following:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LastRef1.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/108758_LastRef1.jpg" style="height: 122px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;However, I only want to the see the very last entry, not last by ResultCode. But when I take out the ResultCode dimension, I get:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LastRef2.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/108759_LastRef2.jpg" style="height: 123px; width: 620px;" /&gt; &lt;/P&gt;&lt;P&gt;The two RefDates are clearly not the same, so I can't see why FSV can't differentiate between them (which I assume is the reason for the "Null" return). I tried:&lt;/P&gt;&lt;P&gt;=If(HistTab.Result_Code &amp;lt;&amp;gt; Null(), aggr(FirstSortedValue(HistTab.Short_Reference,-HistTab.RefDate),HistTab.Company))&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;=If(HistTab.Result_Code &amp;lt;&amp;gt; Null(),FirstSortedValue( aggr(HistTab.Short_Reference,HistTab.Company),-HistTab.RefDate))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all with the same "null" result. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure I'm missing something obvious; can anyone help me out? thanks, Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:21:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000715#M340180</guid>
      <dc:creator />
      <dc:date>2015-12-11T14:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000716#M340181</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;May be try to include Max into your expression as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=If(HistTab.Result_Code &amp;lt;&amp;gt; Null(),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstSortedValue(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Aggr(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(HistTab.Short_Reference,HistTab.Company)),-HistTab.RefDate))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:34:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000716#M340181</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2015-12-11T14:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000717#M340182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried with DISTINCT may be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=If(HistTab.Result_Code &amp;lt;&amp;gt; Null(), FirstSortedValue(&lt;SPAN style="color: #ff0000;"&gt;DISTINCT&lt;/SPAN&gt; HistTab.Short_Reference, -HistTab.RefDate))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:36:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000717#M340182</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-12-11T14:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000718#M340183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin, try with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use the same steps that you used in the chart number one.&lt;/P&gt;&lt;P&gt;2. Hide the field: HistTab.Company&lt;/P&gt;&lt;P&gt;3. Order the table by Last Ref Date&lt;/P&gt;&lt;P&gt;4. Show just one value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot take out the dimension Result_Code because this field use the function firstsortedvalue to order the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that it help you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:39:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000718#M340183</guid>
      <dc:creator />
      <dc:date>2015-12-11T14:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000719#M340184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gabriel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Short_Reference is a string. Max(Short_Reference) won't work, and MaxString would give me, for example, the Ref that starts with "ZZ", which is not what I want. I want the REF with the latest date attached. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks, Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:41:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000719#M340184</guid>
      <dc:creator />
      <dc:date>2015-12-11T14:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000720#M340185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But the field Short_Reference (SR) is already unique, as you can see from the first screen shot. So I don't see how adding DISTINCT will help.&amp;nbsp; (And I tried it, and result was still Null). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks, Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:44:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000720#M340185</guid>
      <dc:creator />
      <dc:date>2015-12-11T14:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000721#M340186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to share a sample?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:46:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000721#M340186</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-12-11T14:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000722#M340187</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;Why not take advantage of the Sort Weigh of FirstSortedValue to rank what to return&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;firstsortedvalue(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;[{set_expression}][ &lt;SPAN class="Bold"&gt;distinct&lt;/SPAN&gt; ] [ &lt;SPAN class="Bold"&gt;total&lt;/SPAN&gt; [&amp;lt;fld {, fld}&amp;gt;]] expression [, sort_weight [, n]]&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 14:55:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000722#M340187</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2015-12-11T14:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000723#M340188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Try&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: calibri, verdana, arial, sans-serif;"&gt;aggr(Maxstring(HistTab.&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: calibri, verdana, arial, sans-serif;"&gt;RefDate&lt;/SPAN&gt;),HistTab.Company)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:03:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000723#M340188</guid>
      <dc:creator>sivarajs</dc:creator>
      <dc:date>2015-12-11T15:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000724#M340189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Er, that is EXACTLY what the "-HistTab.RefDate" is supposed to do. It weights the sort by date, and the "-" sign indicates to return the last value (as opposed to first) by that criterion. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:05:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000724#M340189</guid>
      <dc:creator />
      <dc:date>2015-12-11T15:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000725#M340190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I must not be expressing the problem very well.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LastRef1.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/108773_LastRef1.jpg" style="height: 122px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;There are TWO values for reference. I don't want the one that is alphabetically first or last (as MaxString would give me). I want the one with the LATEST REFERENCE DATE, which is clearly shown in the table above. The REF dates are unique, the REF strings are unique. In the screenshot above, I ONLY want to see the REF string for the most recent REF date (5/28/14). I thought FirstSortedValue(expr, sortweight) would do exactly that, and in fact it does in most applications. I can't understand why it's not working here. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:09:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000725#M340190</guid>
      <dc:creator />
      <dc:date>2015-12-11T15:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000726#M340191</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;Ok that's fine. Thinking of it the sort weight is supposed to return Numeric value. So in that case why not rank the HistTab.RefDate in the script and just return the rank value in your FirstSortedValue (Sort Weight). Just have a small load of your ID (whatever that identify each row) and HistTab.RefDate with Order By HistTab.RefDate Desc or Asc then rename the field (left join it to your FACT table) the use the new field in your FirstSortedValue (Sort Weight).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:17:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000726#M340191</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2015-12-11T15:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue and AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000727#M340192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RefDate is already Numeric; I just use "Date(RefDate,'MM/DD/YY hh:mm) to display it in readable form, as opposed to:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="LastREF3.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/108774_LastREF3.jpg" style="height: 180px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;Don't see why I should need to add RANK to get a numeric result; it already is numeric. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:28:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-and-AGGR/m-p/1000727#M340192</guid>
      <dc:creator />
      <dc:date>2015-12-11T15:28:48Z</dc:date>
    </item>
  </channel>
</rss>

