<?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 Categorize customers dependent on selected Date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146755#M25271</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aloah,&lt;/P&gt;&lt;P&gt;Try this after you have loaded the Orders table in your example:&lt;/P&gt;&lt;P&gt;Load *,&lt;BR /&gt; if (previous(Customer_ID) = Customer_ID, 'Existing', 'New') as Customer_Type&lt;BR /&gt;resident Orders&lt;BR /&gt;order by Customer_ID, Order_Date;&lt;/P&gt;&lt;P&gt;This will create a new table and the original 'Orders' can be dropped.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jun 2009 15:41:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-06-15T15:41:24Z</dc:date>
    <item>
      <title>Categorize customers dependent on selected Date</title>
      <link>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146754#M25270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi *,&lt;BR /&gt;&lt;BR /&gt;I'm trying to categorize my customers into "known-customers" and "new-customers" dependent on the selected order date.&lt;BR /&gt;E.g.&lt;BR /&gt;The Customer 3 (Elvis P.) was created on 03.03.2009. He ordered 07.07.2008 and 01.04.2009.&lt;BR /&gt;If I select the year 2009 he has one order and is a known-customers because there was an order in 2008.&lt;BR /&gt;If I select the year 2008 he is a "new customer" because his first order was in 2008.&lt;BR /&gt;Is there a way to implement this?&lt;/P&gt;&lt;P&gt;Thanks.&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Aloah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 14:08:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146754#M25270</guid>
      <dc:creator />
      <dc:date>2009-06-15T14:08:48Z</dc:date>
    </item>
    <item>
      <title>Categorize customers dependent on selected Date</title>
      <link>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146755#M25271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aloah,&lt;/P&gt;&lt;P&gt;Try this after you have loaded the Orders table in your example:&lt;/P&gt;&lt;P&gt;Load *,&lt;BR /&gt; if (previous(Customer_ID) = Customer_ID, 'Existing', 'New') as Customer_Type&lt;BR /&gt;resident Orders&lt;BR /&gt;order by Customer_ID, Order_Date;&lt;/P&gt;&lt;P&gt;This will create a new table and the original 'Orders' can be dropped.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 15:41:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146755#M25271</guid>
      <dc:creator />
      <dc:date>2009-06-15T15:41:24Z</dc:date>
    </item>
    <item>
      <title>Categorize customers dependent on selected Date</title>
      <link>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146756#M25272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gordon. Works perfect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 15:52:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146756#M25272</guid>
      <dc:creator />
      <dc:date>2009-06-15T15:52:56Z</dc:date>
    </item>
    <item>
      <title>Categorize customers dependent on selected Date</title>
      <link>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146757#M25273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And as a side comment, I believe it is faster and uses less memory to just join the table back to itself rather than loading a new table and dropping the first, i.e.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LEFT JOIN (Orders)&lt;BR /&gt;LOAD&lt;BR /&gt; Order_ID&lt;BR /&gt;,if(previous(Customer_ID)=Customer_ID,'Existing','New') as Customer_Type&lt;BR /&gt;RESIDENT Orders&lt;BR /&gt;ORDER BY Customer_ID, Order_Date&lt;BR /&gt;;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Also, you'll need to use max(Customer_Type) when there are multiple orders in the year, as only the first order will have a customer type of New.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2009 02:49:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Categorize-customers-dependent-on-selected-Date/m-p/146757#M25273</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-06-16T02:49:36Z</dc:date>
    </item>
  </channel>
</rss>

