<?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 first, second, third order flag ... for each customer in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628340#M732591</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have 3 series of data (Customer ID, Order ID and Timestamp- Order Time). i would like to add a new column with a numeric flag for each order and this flag to show if that order was the first one made for that specific customer or the second one or the third one etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Order ID&lt;/TD&gt;&lt;TD&gt;Timestamp order&lt;/TD&gt;&lt;TD&gt;Flag (new column)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;..&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;220&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;140&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;270&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>andreip21</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>first, second, third order flag ... for each customer</title>
      <link>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628340#M732591</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have 3 series of data (Customer ID, Order ID and Timestamp- Order Time). i would like to add a new column with a numeric flag for each order and this flag to show if that order was the first one made for that specific customer or the second one or the third one etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Order ID&lt;/TD&gt;&lt;TD&gt;Timestamp order&lt;/TD&gt;&lt;TD&gt;Flag (new column)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;..&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;220&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;140&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;270&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628340#M732591</guid>
      <dc:creator>andreip21</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: first, second, third order flag ... for each customer</title>
      <link>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628347#M732592</link>
      <description>&lt;P&gt;There you go:&lt;/P&gt;&lt;P&gt;First sort your table by Customer and Timestamp.&lt;/P&gt;&lt;P&gt;Then, build this flag using autonumber() function:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/t5/image/serverpage/image-id/20107i22FF41CB642583FB/image-size/medium?v=1.0&amp;amp;px=-1" border="0" title="clipboard_image_0.png" alt="clipboard_image_0.png" /&gt;&lt;/P&gt;&lt;P&gt;Refer qvw attached as reference.&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Arthur Fong&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 00:06:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628347#M732592</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2019-09-26T00:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: first, second, third order flag ... for each customer</title>
      <link>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628377#M732593</link>
      <description>&lt;P&gt;You can use the autonumber function presented by &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6678"&gt;@Arthur_Fong&lt;/a&gt;&amp;nbsp;, but it will perform slowly on a large data set with many customers. The peek method described below will be a bit more&amp;nbsp; complicated to write, but more effective to run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Customer ,&lt;/P&gt;&lt;P&gt;[Order ID],&lt;/P&gt;&lt;P&gt;[Timestamp order],&lt;/P&gt;&lt;P&gt;If(peek('Customer') =Customer , peek('CustOrderSeq')+1, 1) as CustOrderSeq&lt;/P&gt;&lt;P&gt;Resident&amp;nbsp; Data&amp;nbsp;&lt;/P&gt;&lt;P&gt;Order by Customer, [Timestamp order];&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 04:47:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1628377#M732593</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-09-26T04:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: first, second, third order flag ... for each customer</title>
      <link>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1632182#M732594</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Andrei, did either Arthur's example or Vegar's post help you with a solution?&amp;nbsp; If one or both of them helped, consider using the Accept as Solution button on the post(s) that did help.&amp;nbsp; If you did something different, consider posting that and mark that post, and if you are still working on things, provide an update on where you stand.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is a Design Blog post that may provide another idea, it is not quite the same thing, date-based, but the concept is what I thought might help.&amp;nbsp; I have a feeling Vegar's post is likely the most efficient way to do things in this use case...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;BR /&gt;Brett&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 19:25:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1632182#M732594</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-10-07T19:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: first, second, third order flag ... for each customer</title>
      <link>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1691945#M732595</link>
      <description>&lt;P&gt;Thank you for this code, it really helped me and eased my work. Also learned something new. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 10:22:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/first-second-third-order-flag-for-each-customer/m-p/1691945#M732595</guid>
      <dc:creator>kushagra_jain</dc:creator>
      <dc:date>2020-04-08T10:22:04Z</dc:date>
    </item>
  </channel>
</rss>

