<?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: Select n-th value in a field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528549#M1129417</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a set statement within a set statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It selects the max(Month) from only the records that have an Actual value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum&lt;/STRONG&gt;(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;{$&amp;lt;month={"$(=max(&lt;STRONG&gt;{$&amp;lt;Actual={"&amp;gt;=$(=min(Actual))&amp;lt;=$(=max(Actual))"}&amp;gt;}&lt;/STRONG&gt;month))"}&amp;gt;} &lt;/SPAN&gt; actual)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Dec 2013 18:34:25 GMT</pubDate>
    <dc:creator>wallinpeter</dc:creator>
    <dc:date>2013-12-04T18:34:25Z</dc:date>
    <item>
      <title>Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528548#M1129416</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 need help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have a very simple table with 24 rows (one for each month from Jan 2013 to Dec 2014) and 3 columns (goal, projection, actual) that I am using for a line chart. The chart shows the goal and the projection lines for the the entire data set (Jan 2013 to Dec 2014) and the actual line for what we know (Jan 2013 to Nov 2013).&lt;/P&gt;&lt;P&gt;I do not want to add values to all data points&amp;nbsp; because it would clutter the chart, but I want to tell the reader exactly where we are today (value of actual for this month) and where we are going (value of projection for next month).&amp;nbsp;&amp;nbsp; I plan to do this by adding a text box in the chart (presentation tab, "text in chart") and I am struggling with the set analysis syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because I have data points for the goal and the projection all the way to Dec 2014, I cannot use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ='Actual: ' &amp;amp; sum({$&amp;lt;month={"$(=max(month))"}&amp;gt;} actual&lt;/P&gt;&lt;P&gt;and because the actual progression is not linear, I cannot use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ='Actual: ' &amp;amp; max(actual)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I thought about using the n-th item in my list of actuals.&amp;nbsp; I know what the values I want to use are the latest in the actual column and the next for the projection column, which I can figure out with =COUNT(actual) and =COUNT(actual)+1, but I do not know how to say in my expression "use the (count(actual))-th item from the field named actual" and "use the (count(actula)+1)-th item from the field named projection".&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Marina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 18:10:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528548#M1129416</guid>
      <dc:creator />
      <dc:date>2013-12-04T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528549#M1129417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a set statement within a set statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It selects the max(Month) from only the records that have an Actual value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum&lt;/STRONG&gt;(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;{$&amp;lt;month={"$(=max(&lt;STRONG&gt;{$&amp;lt;Actual={"&amp;gt;=$(=min(Actual))&amp;lt;=$(=max(Actual))"}&amp;gt;}&lt;/STRONG&gt;month))"}&amp;gt;} &lt;/SPAN&gt; actual)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 18:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528549#M1129417</guid>
      <dc:creator>wallinpeter</dc:creator>
      <dc:date>2013-12-04T18:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528550#M1129418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sum(goal) = Show you all the months&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Aggr(Sum(actual), Periodo) &amp;gt;0, Aggr(Sum(goal), Periodo))&amp;nbsp; = show you just sum of goals when in the moth are actual data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 18:36:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528550#M1129418</guid>
      <dc:creator>angelaecheverri</dc:creator>
      <dc:date>2013-12-04T18:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528551#M1129419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Peter &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The expresion returns a value, but the value is exactly the one before the one I want.&amp;nbsp; What am I doing wrong?!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 18:54:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528551#M1129419</guid>
      <dc:creator />
      <dc:date>2013-12-04T18:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528552#M1129420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gracias Angela &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What do I use for "Periodo"?&amp;nbsp; I tried NOW() and TODAY() but the expression returns a "-"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 18:55:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528552#M1129420</guid>
      <dc:creator />
      <dc:date>2013-12-04T18:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528553#M1129421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=subfield(concat({1}actual, ','), ',', count({1}actual))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=subfield(concat({1}projection, ','), ',', count({1}actual)+1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 18:56:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528553#M1129421</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2013-12-04T18:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528554#M1129422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is grabbing the Actual value for the wrong month?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you copy paste data and bold the the value you want returned.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 19:03:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528554#M1129422</guid>
      <dc:creator>wallinpeter</dc:creator>
      <dc:date>2013-12-04T19:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528555#M1129423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No!! My bad!&lt;/P&gt;&lt;P&gt;This works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Thanks Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 19:10:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528555#M1129423</guid>
      <dc:creator />
      <dc:date>2013-12-04T19:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528556#M1129424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thaks Jeremy. &lt;/P&gt;&lt;P&gt;The expression works too but it does not take into account selections (I forgot to mention: I allow readers to narrow down the year they want to see), so it always return the latest month, even if I select a different year.&amp;nbsp; Is there an easy way to tell the expresion to "stick to the selection" insead of "use the entire data set"?&lt;/P&gt;&lt;P&gt;Also, if you have a moment, could you please explain how "subfield" and "concat" work in this logic? &lt;/P&gt;&lt;P&gt;Thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 19:14:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528556#M1129424</guid>
      <dc:creator />
      <dc:date>2013-12-04T19:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528557#M1129425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For something like this:&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: 10pt; line-height: 1.5em;"&gt;&lt;STRONG&gt;=subfield(concat({1}actual, ','), ',', count({1}actual))&lt;/STRONG&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: 10pt; line-height: 1.5em;"&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: 10pt; line-height: 1.5em;"&gt;the 1 will ignore all selections. If you want it to go with the selections, then remove the 1's.&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: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; color: #3d3d3d; font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;=subfield(concat(actual, ','), ',', count(actual))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The concat function will combine all your field values into one string with the delimiter of ',' in this example.&lt;/P&gt;&lt;P&gt;(On a side note: You can also use the third parameter of concat to establish the sorting of the string.)&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;"&gt;Then subfield will go through this string and get the count(actual)-th item using the , as a delimiter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&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;"&gt;So if you had a field like Fruit:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Then did &lt;STRONG&gt;concat(Fruit, ',')&lt;/STRONG&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;"&gt;your result would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&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;"&gt;Apple, Orange, Peach, Banana&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&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;"&gt;Then &lt;STRONG&gt;subfield(concat(Fruit, ','), ',' , 3)&lt;/STRONG&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;"&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;"&gt;would return:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&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;"&gt;Peach&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&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;"&gt;Hope this helps!&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;"&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;"&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;"&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;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 19:35:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528557#M1129425</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2013-12-04T19:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528558#M1129426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anytime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set Analysis is hugely powerful. Highly recommend you become proficient in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a tutorial QVW.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 20:28:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528558#M1129426</guid>
      <dc:creator>wallinpeter</dc:creator>
      <dc:date>2013-12-04T20:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select n-th value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528559#M1129427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure does &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks again Jeremy!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2013 20:39:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Select-n-th-value-in-a-field/m-p/528559#M1129427</guid>
      <dc:creator />
      <dc:date>2013-12-04T20:39:00Z</dc:date>
    </item>
  </channel>
</rss>

