<?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 Recursive Problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229528#M81427</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If by "initial order" you mean the first order for that customer, ever, regardless of any selections, perhaps handle it in script.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;LEFT JOIN ([Product Orders])&lt;BR /&gt;LOAD&lt;BR /&gt; YourUniqueKeyField&lt;BR /&gt;,if(OrderTimestamp&amp;lt;=FirstOrderTimestamp+3,'Y','N') as OrderedWithin72Hours?&lt;BR /&gt;;&lt;BR /&gt;LOAD&lt;BR /&gt; YourUniqueKeyField&lt;BR /&gt;,OrderTimestamp&lt;BR /&gt;,if(OrderByUserId&amp;lt;&amp;gt;previous(OrderByUserId),OrderTimestamp,peek(FirstOrderTimestamp)) as FirstOrderTimestamp&lt;BR /&gt;RESIDENT [Product Orders]&lt;BR /&gt;ORDER BY OrderByUserId, OrderTimestamp&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Then your chart is pretty simple:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Dimension = OrderByUserId&lt;BR /&gt;Expression = count({&amp;lt;OrderedWithin72Hours?={'Y'}&amp;gt;} distinct ProductId)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 May 2010 01:31:11 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2010-05-01T01:31:11Z</dc:date>
    <item>
      <title>Recursive Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229527#M81426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having problem with the recursion, as i need to find the following from the same table.&lt;/P&gt;&lt;P&gt;For my problem i'm taking product orders as sample data.&lt;/P&gt;&lt;P&gt;Problem : I need to find count of all the products which was ordered by same person within 72 hours of initial order.&lt;/P&gt;&lt;P&gt;Product Orders:&lt;/P&gt;&lt;P&gt;ProductId OrderDate OrderByUserId&lt;/P&gt;&lt;P&gt;1 12/12/10 3:45 1&lt;/P&gt;&lt;P&gt;2 12/12/10 4:45 2&lt;/P&gt;&lt;P&gt;1 12/13/10 3:45 1&lt;/P&gt;&lt;P&gt;2 12/12/10 4:45 33&lt;/P&gt;&lt;P&gt;2 12/16/10 4:45 12&lt;/P&gt;&lt;P&gt;2 12/12/10 4:45 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Problem : I need to find count of all the products which was ordered by same person within 72 hours of initial order.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;I'm not even sure if we can do this in Qlikview, Any help would be greatly appreciated.&lt;/B&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 May 2010 01:13:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229527#M81426</guid>
      <dc:creator />
      <dc:date>2010-05-01T01:13:46Z</dc:date>
    </item>
    <item>
      <title>Recursive Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229528#M81427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If by "initial order" you mean the first order for that customer, ever, regardless of any selections, perhaps handle it in script.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;LEFT JOIN ([Product Orders])&lt;BR /&gt;LOAD&lt;BR /&gt; YourUniqueKeyField&lt;BR /&gt;,if(OrderTimestamp&amp;lt;=FirstOrderTimestamp+3,'Y','N') as OrderedWithin72Hours?&lt;BR /&gt;;&lt;BR /&gt;LOAD&lt;BR /&gt; YourUniqueKeyField&lt;BR /&gt;,OrderTimestamp&lt;BR /&gt;,if(OrderByUserId&amp;lt;&amp;gt;previous(OrderByUserId),OrderTimestamp,peek(FirstOrderTimestamp)) as FirstOrderTimestamp&lt;BR /&gt;RESIDENT [Product Orders]&lt;BR /&gt;ORDER BY OrderByUserId, OrderTimestamp&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Then your chart is pretty simple:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Dimension = OrderByUserId&lt;BR /&gt;Expression = count({&amp;lt;OrderedWithin72Hours?={'Y'}&amp;gt;} distinct ProductId)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 May 2010 01:31:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229528#M81427</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-05-01T01:31:11Z</dc:date>
    </item>
    <item>
      <title>Recursive Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229529#M81428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You John,&lt;/P&gt;&lt;P&gt;Let me try this, i tried something similar but in a different way(SQL recursive query) but your solution seems better as what i did was extremely slow considering 2 mil+ rows .&lt;/P&gt;&lt;P&gt;Thanks for quick reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 May 2010 01:51:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229529#M81428</guid>
      <dc:creator />
      <dc:date>2010-05-01T01:51:08Z</dc:date>
    </item>
    <item>
      <title>Recursive Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229530#M81429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;Thank you for the solution, it worked fine, the only problem i had was that i had multiple dates to compare, it became really complicated load but it's working like a charm.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 May 2010 22:05:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recursive-Problem/m-p/229530#M81429</guid>
      <dc:creator />
      <dc:date>2010-05-04T22:05:48Z</dc:date>
    </item>
  </channel>
</rss>

