<?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: 2nd Value Group By in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617240#M682881</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Byron, You can Try with &lt;STRONG&gt;Min&lt;/STRONG&gt; function like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Min(Timestamp,2)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 22 Feb 2014 20:30:34 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-02-22T20:30:34Z</dc:date>
    <item>
      <title>2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617234#M682872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am battling to figure this out. Below is my sample data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;ID, HistoryID, TimeStamp&lt;/P&gt;&lt;P&gt;1,1,02/08/2014 14:00:00&lt;/P&gt;&lt;P&gt;1,2,02/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;1,3,02/08/2014 14:56:00&lt;/P&gt;&lt;P&gt;2,4,04/08/2014 11:05:00&lt;/P&gt;&lt;P&gt;2,5,04/08/2014 12:15:00&lt;/P&gt;&lt;P&gt;3,6,06/08/2014 13:00:00&lt;/P&gt;&lt;P&gt;3,7,06/08/2014 13:50:00&lt;/P&gt;&lt;P&gt;3,8,07/08/2014 14:00:00&lt;/P&gt;&lt;P&gt;3,9,07/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want is a table that has the 2nd value for each grouped ID added as a new column&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID, HistoryID, TimeStamp, 2ndValue&lt;/P&gt;&lt;P&gt;1,1,02/08/2014 14:00:00,02/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;1,2,02/08/2014 14:26:00,02/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;1,3,02/08/2014 14:56:00,02/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;2,4,04/08/2014 11:05:00,04/08/2014 12:15:00&lt;/P&gt;&lt;P&gt;2,5,04/08/2014 12:15:00,04/08/2014 12:15:00&lt;/P&gt;&lt;P&gt;3,6,06/08/2014 13:00:00,06/08/2014 13:50:00&lt;/P&gt;&lt;P&gt;3,7,06/08/2014 13:50:00,06/08/2014 13:50:00&lt;/P&gt;&lt;P&gt;3,8,07/08/2014 14:00:00,06/08/2014 13:50:00&lt;/P&gt;&lt;P&gt;3,9,07/08/2014 14:26:00,06/08/2014 13:50:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do this in a simple way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please urgently need your help figuring this one out&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Byron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 08:08:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617234#M682872</guid>
      <dc:creator />
      <dc:date>2014-02-21T08:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: 2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617235#M682873</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;you need to build a loop over the group_IDs and then use the max([field], 1) function - is the first thing that comes to my mind. There might be an easier way or you might be able to do it in one pass - but I think that one of the main objectives should always be that others with no more than general IT knowledge should be able to understand your code - so I'd rather do a loop here than a "complicated" construct with WHERE() and GROUP BY and whatnot...&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 08:16:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617235#M682873</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-02-21T08:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: 2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617236#M682874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here the script:&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;ID, HistoryID, TimeStamp&lt;/P&gt;&lt;P&gt;1,1,02/08/2014 14:00:00&lt;/P&gt;&lt;P&gt;1,2,02/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;1,3,02/08/2014 14:56:00&lt;/P&gt;&lt;P&gt;2,4,04/08/2014 11:05:00&lt;/P&gt;&lt;P&gt;2,5,04/08/2014 12:15:00&lt;/P&gt;&lt;P&gt;3,6,06/08/2014 13:00:00&lt;/P&gt;&lt;P&gt;3,7,06/08/2014 13:50:00&lt;/P&gt;&lt;P&gt;3,8,07/08/2014 14:00:00&lt;/P&gt;&lt;P&gt;3,9,07/08/2014 14:26:00&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;load ID,&lt;/P&gt;&lt;P&gt;FirstSortedValue(TimeStamp,HistoryID,2) as SecondTimeStamp&lt;/P&gt;&lt;P&gt;resident Data&lt;/P&gt;&lt;P&gt;group by ID&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See also attached&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 08:17:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617236#M682874</guid>
      <dc:creator>martinpohl</dc:creator>
      <dc:date>2014-02-21T08:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: 2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617237#M682876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can go with either iteration or the group by function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 08:21:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617237#M682876</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2014-02-21T08:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: 2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617238#M682878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is pretty easy - and straightforward to understand. I'd recommend that. Didn't know yet that FirstSortedValue could also return the second value in a group ...&lt;/P&gt;&lt;P&gt;Again what learned &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 08:23:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617238#M682878</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-02-21T08:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: 2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617239#M682879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agree with Nibbler! Didn't know firstsorted value had a rank parameter. Awesome and clean solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Byron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Feb 2014 08:31:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617239#M682879</guid>
      <dc:creator />
      <dc:date>2014-02-21T08:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: 2nd Value Group By</title>
      <link>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617240#M682881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Byron, You can Try with &lt;STRONG&gt;Min&lt;/STRONG&gt; function like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Min(Timestamp,2)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Feb 2014 20:30:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2nd-Value-Group-By/m-p/617240#M682881</guid>
      <dc:creator />
      <dc:date>2014-02-22T20:30:34Z</dc:date>
    </item>
  </channel>
</rss>

