<?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: First Sorted Value, set analysis and aggr.. it's aggravating! in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904093#M658387</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try with Concat cat function with substring for 1st and second record &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=SubField(Concat([Col],'@',1/[GroupCol]),'@',1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify as required in your scenario &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;BKC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 May 2015 13:30:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-05-08T13:30:32Z</dc:date>
    <item>
      <title>First Sorted Value, set analysis and aggr.. it's aggravating!</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904092#M658386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simple enough task: Find the last call where the ActCode was "MDC" and the person who made it was the CSR assigned to the account. Then, find the last&amp;nbsp; and second last call by the CSR that DOES NOT have 'MDC' as the ActCode. Here's a small sample of the data:(what I want for the first call is 5/6/15 10:05:59, and the second call is 5/5/15 9:10:34)&lt;/P&gt;&lt;P&gt;&lt;IMG alt="mdc.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/86035_mdc.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;First attempt was this: &lt;SPAN style="font-size: 10pt;"&gt;=&lt;SPAN style="color: #0000ff;"&gt;FirstSortedValue&lt;/SPAN&gt;({$&amp;lt;&lt;SPAN style="color: #800000;"&gt;[GMA.ActCode]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; -= {'MDC'} &amp;gt; } GMA.FullTime,-GMA.FullTime) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;which works, except that &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;it returns "5/6/15 16:26:34" , where the HistUser (the user who made the call) was not the CSR.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;So, I tried =FirstSortedValue({$&amp;lt;[GMA.ActCode]-={'MDC'},[GMA.CSR]={GMA.HistUser}&amp;gt;} GMA.FullTime, -GMA.FullTime)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;but that returns null.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;So I tried =if(GMA.CSR=GMA.HistUser&lt;/SPAN&gt;,&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FirstSortedValue&lt;/SPAN&gt;&lt;SPAN&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[GMA.ActCode]&lt;/SPAN&gt;&lt;SPAN&gt; -= {'MDC'} &amp;gt; } GMA.FullTime,-GMA.FullTime))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;but that returns null. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I tried &lt;SPAN style="font-size: 10pt;"&gt;=&lt;SPAN style="color: #0000ff;"&gt;aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;FirstSortedValue&lt;/SPAN&gt;({$&amp;lt;&lt;SPAN style="color: #800000;"&gt;[GMA.ActCode]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; -= {'MDC'} &amp;gt; } GMA.FullTime,-GMA.FullTime),GMA.CSR) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which returns 5/6/15 16:26:34 (and which is correct, since this is the last non-MDC call aggregated by CSR, but it doesn't give me what I want).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I specify: the last (and the second last) call made where the ActCode is NOT "MDC" and the HistUser=CSR?&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, 08 May 2015 13:21:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904092#M658386</guid>
      <dc:creator />
      <dc:date>2015-05-08T13:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value, set analysis and aggr.. it's aggravating!</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904093#M658387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try with Concat cat function with substring for 1st and second record &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=SubField(Concat([Col],'@',1/[GroupCol]),'@',1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify as required in your scenario &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;BKC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 13:30:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904093#M658387</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-08T13:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value, set analysis and aggr.. it's aggravating!</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904094#M658388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This expression is incorrect:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;=FirstSortedValue({$&amp;lt;[GMA.ActCode]-={'MDC'},&lt;STRONG&gt;[GMA.CSR]={GMA.HistUser}&lt;/STRONG&gt;&amp;gt;} GMA.FullTime, -GMA.FullTime)&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: 13.3333330154419px;"&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: 13.3333330154419px;"&gt;Should be like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13.3333330154419px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;=FirstSortedValue({$&amp;lt;[GMA.ActCode]-={'MDC'},&lt;STRONG&gt;[GMA.CSR]={"=[GMA.CSR] = [GMA.HistUser]"}&lt;/STRONG&gt;&amp;gt;} GMA.FullTime, -GMA.FullTime)&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: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 13:46:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904094#M658388</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-05-08T13:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value, set analysis and aggr.. it's aggravating!</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904095#M658389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&gt;Should be like this:&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="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&gt;=FirstSortedValue({$&amp;lt;[GMA.ActCode]-={'MDC'},&lt;SPAN style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;&lt;STRONG&gt;[GMA.CSR]={"[GMA.CSR] = [GMA.HistUser]"}&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;} GMA.FullTime, -GMA.FullTime)&lt;/SPAN&gt;&lt;/P&gt;


&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&gt;That's the same as &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&gt;=Max({$&amp;lt;[GMA.ActCode]-={'MDC'},&lt;SPAN style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;&lt;STRONG&gt;[GMA.CSR]={"[GMA.CSR] = [GMA.HistUser]"}&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;} GMA.FullTime)&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="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&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="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&gt;And &lt;SPAN style="color: #3d3d3d; font-family: inherit; font-style: inherit; font-size: 13.3333320617676px;"&gt;&lt;STRONG&gt;[GMA.CSR]={"[GMA.CSR] = [GMA.HistUser]"} &lt;/STRONG&gt;&lt;/SPAN&gt;may or may not give correct results. Judging from the screenshot I'd say it won't. See &lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-4563" style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3778c7; background-color: #f8fbfe;"&gt;set_analysis_intra-record.qvw&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 14:04:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904095#M658389</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-05-08T14:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value, set analysis and aggr.. it's aggravating!</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904096#M658390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;with the data loaded inline, I made it work.&lt;/P&gt;&lt;P&gt;I attached the qvw, hope it helps.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 15:51:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904096#M658390</guid>
      <dc:creator />
      <dc:date>2015-05-08T15:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value, set analysis and aggr.. it's aggravating!</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904097#M658391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to everyone for their replies. In the end, I went back to the user, and found out they are not interested in the actions of anyone besides the assigned CSR (GMA.CSR), so I added to my script:&lt;/P&gt;&lt;P&gt;WHERE GMA.CSR=GMA.HISTUSER&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then was able to use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FirstSortedValue&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[GMA.ActCode]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; -= {'MDC'} &amp;gt; } GMA.FullTime,-GMA.FullTime),GMA.COMPANY) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Again, I thank everyone for their help, and especially Gysbert - his link edified some issues that had mystified me. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Kevin&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 17:47:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-set-analysis-and-aggr-it-s-aggravating/m-p/904097#M658391</guid>
      <dc:creator />
      <dc:date>2015-05-08T17:47:28Z</dc:date>
    </item>
  </channel>
</rss>

