<?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 get the first Num in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476226#M177855</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello swuhl , you are correct,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could it be possible a if stament instead of a left join... or is just the only way to do it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jul 2013 16:13:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-07-12T16:13:49Z</dc:date>
    <item>
      <title>How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476222#M177851</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 have the following sample:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CustomerId, VisitDate, IsBuy&lt;/P&gt;&lt;P&gt;1, 2013-1-1, 0&lt;/P&gt;&lt;P&gt;1, 2013-2-1, 0&lt;/P&gt;&lt;P&gt;1, 2013-3-1, 1&lt;/P&gt;&lt;P&gt;1, 2013-4-1, 1&lt;/P&gt;&lt;P&gt;2, 2013-1-1, 1&lt;/P&gt;&lt;P&gt;3, 2013-5-1, 0&lt;/P&gt;&lt;P&gt;3, 2013-6-1, 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see those kind of records are the attended records for the Customers Visiting. And IsBuy shows whether customer buys something, 1 means bought something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to get is: Add one more column for that table, and show whether this record is the first bought record for the each CustomerId.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take an example: for the Customer 1, the first bought record is the row 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the result is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CustomerId, VisitDate, IsBuy, FirstRecord&lt;/P&gt;&lt;P&gt;1, 2013-1-1, 0 , No&lt;/P&gt;&lt;P&gt;1, 2013-2-1, 0 , No&lt;/P&gt;&lt;P&gt;1, 2013-3-1, 1 , Yes&lt;/P&gt;&lt;P&gt;1, 2013-4-1, 1,&amp;nbsp; No&lt;/P&gt;&lt;P&gt;2, 2013-1-1, 1,&amp;nbsp; Yes&lt;/P&gt;&lt;P&gt;3, 2013-5-1, 0,&amp;nbsp; No&lt;/P&gt;&lt;P&gt;3, 2013-6-1, 1, Yes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can we do that in the QlikView loading script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 14:56:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476222#M177851</guid>
      <dc:creator />
      <dc:date>2013-07-12T14:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476223#M177852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INPUT:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;CustomerId, VisitDate, IsBuy&lt;/P&gt;&lt;P&gt;1, 2013-1-1, 0&lt;/P&gt;&lt;P&gt;1, 2013-2-1, 0&lt;/P&gt;&lt;P&gt;1, 2013-3-1, 1&lt;/P&gt;&lt;P&gt;1, 2013-4-1, 1&lt;/P&gt;&lt;P&gt;2, 2013-1-1, 1&lt;/P&gt;&lt;P&gt;3, 2013-5-1, 0&lt;/P&gt;&lt;P&gt;3, 2013-6-1, 1&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEFT JOIN (INPUT)&lt;/P&gt;&lt;P&gt;LOAD CustomerId, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsBuy, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FirstValue(if(IsBuy=1,VisitDate)) as VisitDate, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsBuy as FirstBuy &lt;/P&gt;&lt;P&gt;Resident INPUT &lt;/P&gt;&lt;P&gt;group by CustomerId, IsBuy &lt;/P&gt;&lt;P&gt;order by VisitDate;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 15:18:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476223#M177852</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-07-12T15:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476224#M177853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this one:&lt;/P&gt;&lt;P&gt;If(previous(CustomerId)=Custemerid and IsBuy=1,'Yes','No') as FirstRecord&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have order it by Customerid and Date,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 15:26:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476224#M177853</guid>
      <dc:creator />
      <dc:date>2013-07-12T15:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476225#M177854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I use this, I do get a different outcome than expected:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="278"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="81"&gt;CustomerId&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="90"&gt;VisitDate&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="37"&gt;IsBuy&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="70"&gt;FirstRecord&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-1-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-2-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-3-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-4-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-1-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-5-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2013-6-1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 15:52:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476225#M177854</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-07-12T15:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476226#M177855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello swuhl , you are correct,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could it be possible a if stament instead of a left join... or is just the only way to do it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 16:13:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476226#M177855</guid>
      <dc:creator />
      <dc:date>2013-07-12T16:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476227#M177856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Potentially yes, but I think not in one load run. The issue is, you need to flag the first buy, and only the first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: You actually can. But I don't think using peek() or previous() function, instead using autonumber():&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INPUT:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;CustomerId, VisitDate, IsBuy&lt;/P&gt;&lt;P&gt;1, 2013-1-1, 0&lt;/P&gt;&lt;P&gt;1, 2013-2-1, 0&lt;/P&gt;&lt;P&gt;1, 2013-3-1, 1&lt;/P&gt;&lt;P&gt;1, 2013-4-1, 1&lt;/P&gt;&lt;P&gt;2, 2013-1-1, 1&lt;/P&gt;&lt;P&gt;3, 2013-5-1, 0&lt;/P&gt;&lt;P&gt;3, 2013-6-1, 1&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( autonumber(if(IsBuy, VisitDate),CustomerId) = 1,'Yes','No') as FirstBuy&amp;nbsp; &lt;/P&gt;&lt;P&gt;RESIDENT INPUT &lt;/P&gt;&lt;P&gt;ORDER BUY CustomerId, VisitDate;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 16:18:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476227#M177856</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-07-12T16:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the first Num</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476228#M177857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Swuehl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jul 2013 19:29:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-the-first-Num/m-p/476228#M177857</guid>
      <dc:creator />
      <dc:date>2013-07-17T19:29:41Z</dc:date>
    </item>
  </channel>
</rss>

