<?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: How to make a Field Value Instance Counter? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617677#M227628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think they both work but I've used yours almost exactly Matt. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Feb 2014 16:11:16 GMT</pubDate>
    <dc:creator>scotthan</dc:creator>
    <dc:date>2014-02-10T16:11:16Z</dc:date>
    <item>
      <title>How to make a Field Value Instance Counter?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617673#M227624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community, I'm hoping to avoid a loop on this and feel like there must be a way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I have a table like the one I've created below&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;Table:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;/STRONG&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;Case, StartDate, EndDate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;1, 1, 2&lt;BR /&gt;1, 4, 5&lt;BR /&gt;2, 3, 4&lt;BR /&gt;1, 7, 8&lt;BR /&gt;2, 5, 6&lt;BR /&gt;1, 9, 9&lt;BR /&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;I'd like to add a column to this table which is what I'm calling a "field value instance counter". This is because the same case can open (start) multiple times. For the first value of field Case, new field is 1. If the second value of Case is the same as the first, new field would be 2 on that row. Rather than trying to continue this explanation, here's what I want to get to:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;Case, Start, End, FieldValueInstanceCounter&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;1, 1, 2, 1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;1, 4, 5, 2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;2, 3, 4, 1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;1, 7, 8, 3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;2, 5, 6, 2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;1, 9, 9, 4&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;Any ideas? &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 17:36:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617673#M227624</guid>
      <dc:creator>scotthan</dc:creator>
      <dc:date>2014-02-06T17:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a Field Value Instance Counter?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617674#M227625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Temp:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt;&lt;SPAN style="color: #0000ff; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit; color: #0000ff;"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit; color: #800000;"&gt;[&lt;BR /&gt;Case, StartDate, EndDate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit; color: #800000;"&gt;1, 1, 2&lt;BR /&gt;1, 4, 5&lt;BR /&gt;2, 3, 4&lt;BR /&gt;1, 7, 8&lt;BR /&gt;2, 5, 6&lt;BR /&gt;1, 9, 9&lt;BR /&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 8pt; font-family: inherit;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 8pt; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;Result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt; Case, StartDate, EndDate,&lt;STRONG&gt; if(previous(Case)=Case,peek(Counter)+1,1) as Counter&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;resident&lt;/SPAN&gt; Temp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;order by&lt;/SPAN&gt; Case, &lt;SPAN style="font-size: 11.111111640930176px;"&gt;StartDate&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;drop Table&lt;/SPAN&gt; Temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 17:42:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617674#M227625</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-02-06T17:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a Field Value Instance Counter?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617675#M227626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the data above I did this and think it works:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s1"&gt;Table1:&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; * &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;INLINE&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;[&lt;BR /&gt; Case, StartDate, EndDate&lt;BR /&gt; 1, 1, 2&lt;BR /&gt; 1, 4, 5&lt;BR /&gt; 2, 3, 4&lt;BR /&gt; 1, 7, 8&lt;BR /&gt; 2, 5, 6&lt;BR /&gt; 1, 9, 9&lt;BR /&gt; ]&lt;SPAN class="s1"&gt;;&lt;BR /&gt; &lt;BR /&gt; Table1_tmp:&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;NoConcatenate&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; *,&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;if&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;Case&lt;SPAN class="s1"&gt; = &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Previous&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;Case&lt;SPAN class="s1"&gt;), &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Peek&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;(&lt;/SPAN&gt;FieldInstanceCounter&lt;SPAN class="s1"&gt;) + 1, 1) &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;as&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;FieldInstanceCounter&lt;SPAN class="s1"&gt;&amp;nbsp; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;RESIDENT&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; Table1&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Order&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;by&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;Case&lt;SPAN class="s1"&gt;, &lt;/SPAN&gt;StartDate&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;asc&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;&lt;STRONG&gt;DROP&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;table&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; Table1;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;&lt;STRONG&gt;RENAME&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;table&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; Table1_tmp &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;to&lt;/SPAN&gt;&lt;SPAN class="s1"&gt; Table1;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s1"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="s1"&gt;See qvw attached.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 17:49:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617675#M227626</guid>
      <dc:creator />
      <dc:date>2014-02-06T17:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a Field Value Instance Counter?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617676#M227627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did either of these solutions work for you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 16:05:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617676#M227627</guid>
      <dc:creator />
      <dc:date>2014-02-10T16:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a Field Value Instance Counter?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617677#M227628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think they both work but I've used yours almost exactly Matt. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 16:11:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617677#M227628</guid>
      <dc:creator>scotthan</dc:creator>
      <dc:date>2014-02-10T16:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a Field Value Instance Counter?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617678#M227629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad it worked out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 16:16:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-a-Field-Value-Instance-Counter/m-p/617678#M227629</guid>
      <dc:creator />
      <dc:date>2014-02-10T16:16:29Z</dc:date>
    </item>
  </channel>
</rss>

