<?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 with string and date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416769#M483920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally fixed it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone in future, there were two issues that I hadn't addressed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Firstly there were more than one name per Date, so a Distinct in the FirstSortedValue was needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly although i had a Date#(Date) in my initial load i didnt put what format the date was in. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my ending results were, in my load statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date#(RIGHT([Date],7),'MM/YYYY') as [Date],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this was to return the month and year only, I could have achived this with the date format at the top but i bring other dates into my model also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly in the expression:&lt;/P&gt;&lt;P&gt;=FirstSortedValue(DISTINCT mob_ServiceOwner,-[Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which returned the correct results, (although my qlikview doesn't recognise Distinct and puts the red line underneath to show error)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Jun 2013 01:00:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-06-06T01:00:10Z</dc:date>
    <item>
      <title>FirstSortedValue with string and date</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416764#M483915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Service No&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;abc&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;05/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xyz&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;05/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;abc&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;04/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xyz&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;04/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;abc&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xyz&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;03/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;02/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xyz&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;02/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;01/2013&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now what i want is for any month to find the name accosiated with the service, or the most recent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g. service 1 on 03/2013, i require it to return xyz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if no month is selected i require it to return the most recent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. Service 2 to return xyz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could use maxstring, but i need it ordered by date not alaphabetically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried using firstsortedvalue(Name,Date) when it's filtered on a service but still no luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 May 2013 03:15:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416764#M483915</guid>
      <dc:creator />
      <dc:date>2013-05-29T03:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with string and date</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416765#M483916</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;Try below mentioned script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ServiceNo&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,'MMM-YY'),'MMM YYYY') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;len&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)=0,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;NewName&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;NewName&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name, ServiceNo, Date&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; abc, 1, May-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xyz, 2, May-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; abc, 1, Apr-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xyz, 2, Apr-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; abc, 1, Mar-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xyz, 2, Mar-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 1, Feb-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xyz, 2, Feb-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 1, Jan-13&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 2, Jan-13&lt;BR /&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Find the attached file&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 May 2013 05:02:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416765#M483916</guid>
      <dc:creator>kumarnatarajan</dc:creator>
      <dc:date>2013-05-29T05:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with string and date</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416766#M483917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would work but all the data is dynamic, therefore a inline is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just need to choose the name per service number with the greatest date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 05:45:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416766#M483917</guid>
      <dc:creator />
      <dc:date>2013-06-05T05:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with string and date</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416767#M483918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FirstSortedValue() should work just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need a numeric Date, which I assume that's what you created (using QV date / time functions).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then create a table chart with service number as dimension and as expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedvalue(Name, -Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Minus sign is important to get the most recent / highest date, not the lowest]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 07:45:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416767#M483918</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-06-05T07:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with string and date</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416768#M483919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My Date is converted into just MM/YYYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in my formula i wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue(Name,-Num('01/'&amp;amp;[Date]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which still does not return any results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 23:11:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416768#M483919</guid>
      <dc:creator />
      <dc:date>2013-06-05T23:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue with string and date</title>
      <link>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416769#M483920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally fixed it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone in future, there were two issues that I hadn't addressed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Firstly there were more than one name per Date, so a Distinct in the FirstSortedValue was needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly although i had a Date#(Date) in my initial load i didnt put what format the date was in. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my ending results were, in my load statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date#(RIGHT([Date],7),'MM/YYYY') as [Date],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this was to return the month and year only, I could have achived this with the date format at the top but i bring other dates into my model also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly in the expression:&lt;/P&gt;&lt;P&gt;=FirstSortedValue(DISTINCT mob_ServiceOwner,-[Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which returned the correct results, (although my qlikview doesn't recognise Distinct and puts the red line underneath to show error)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 01:00:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FirstSortedValue-with-string-and-date/m-p/416769#M483920</guid>
      <dc:creator />
      <dc:date>2013-06-06T01:00:10Z</dc:date>
    </item>
  </channel>
</rss>

