<?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 SQL SubQuery Equivalent in QlikScript? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134249#M19953</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;Date,Sales&lt;/P&gt;&lt;P&gt;12-07-2016,3&lt;/P&gt;&lt;P&gt;13-07-2016,9&lt;/P&gt;&lt;P&gt;14-07-2016,1&lt;/P&gt;&lt;P&gt;19-07-2016,10&lt;/P&gt;&lt;P&gt;22-07-2016,2&lt;/P&gt;&lt;P&gt;25-07-2016,0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OutPut:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Date,Sales,Selective_Sum&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;12-07-2016,3,0&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;13-07-2016,9,3&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;14-07-2016,1,12&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;19-07-2016,10,0&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;22-07-2016,2,10&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;25-07-2016,0,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Logic: &lt;SPAN style="font-size: 13.3333px;"&gt;Selective_Sum = Sum of Sales in Last Three Days from the current date for each row.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If I were to do this is SQL ,that would be a piece of cake using a subquery.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Note: You are free to order things up.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Note: There are gaps between the dates. Sum of Last three rows is not the solution I am looking for.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Please avoid loops if possible.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thanks alot in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 24 Jul 2016 19:25:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-07-24T19:25:46Z</dc:date>
    <item>
      <title>SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134249#M19953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;Date,Sales&lt;/P&gt;&lt;P&gt;12-07-2016,3&lt;/P&gt;&lt;P&gt;13-07-2016,9&lt;/P&gt;&lt;P&gt;14-07-2016,1&lt;/P&gt;&lt;P&gt;19-07-2016,10&lt;/P&gt;&lt;P&gt;22-07-2016,2&lt;/P&gt;&lt;P&gt;25-07-2016,0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OutPut:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Date,Sales,Selective_Sum&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;12-07-2016,3,0&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;13-07-2016,9,3&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;14-07-2016,1,12&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;19-07-2016,10,0&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;22-07-2016,2,10&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;25-07-2016,0,2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Logic: &lt;SPAN style="font-size: 13.3333px;"&gt;Selective_Sum = Sum of Sales in Last Three Days from the current date for each row.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If I were to do this is SQL ,that would be a piece of cake using a subquery.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Note: You are free to order things up.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Note: There are gaps between the dates. Sum of Last three rows is not the solution I am looking for.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Please avoid loops if possible.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thanks alot in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Jul 2016 19:25:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134249#M19953</guid>
      <dc:creator />
      <dc:date>2016-07-24T19:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134250#M19954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/132298_1.png" style="height: auto; width: auto;" /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SET DateFormat='DD-MM-YYYY';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Table:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD * Inline [&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Date,Sales&lt;/P&gt;&lt;P&gt;12-07-2016,3&lt;/P&gt;&lt;P&gt;13-07-2016,9&lt;/P&gt;&lt;P&gt;14-07-2016,1&lt;/P&gt;&lt;P&gt;19-07-2016,10&lt;/P&gt;&lt;P&gt;22-07-2016,2&lt;/P&gt;&lt;P&gt;25-07-2016,0&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left Join (Table)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date +1 as Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Sales as Sales_1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Table;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left Join (Table)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date +2 as Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Sales as Sales_2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Table;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left Join (Table)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date +3 as Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Sales as Sales_3&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Table;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left Join (Table)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; RangeSum(Sales_1, Sales_2, Sales_3) as Selective_Sum&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Table;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Jul 2016 21:32:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134250#M19954</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2016-07-24T21:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134251#M19955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks maxgro, but I am looking for a solution implementing a conditional statement, cause if I were to extend it for say last six month, this method 'll break. This example is oversimplified but you have shown a direction that might lead to the correct solution.&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2016 02:31:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134251#M19955</guid>
      <dc:creator />
      <dc:date>2016-07-25T02:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134252#M19956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rangesum(&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(Date=Peek('Date',-1)+1,Peek('Sales',-1)),&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(Date=Peek('Date',-2)+2,Peek('Sales',-2)),&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(Date=Peek('Date',-3)+3,Peek('Sales',-3))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) as Selective_Sum&lt;/P&gt;&lt;P&gt;RESIDENT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Temp&lt;/P&gt;&lt;P&gt;Order By&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2016 07:07:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134252#M19956</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-07-25T07:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134253#M19957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thx &lt;SPAN class="j-post-author"&gt;&lt;STRONG&gt;&lt;A href="https://community.qlik.com/people/gwassenaar"&gt;gwassenaar&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2016 07:31:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134253#M19957</guid>
      <dc:creator />
      <dc:date>2016-07-25T07:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134254#M19958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, you asked for the last three days, not then last six months. If you're not clear about what you want you don't get it. See &lt;A href="https://community.qlik.com/docs/DOC-4252"&gt;Calculating rolling n-period totals, averages or other aggregations&lt;/A&gt; for an approach that can give you what you now asked for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2016 07:41:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134254#M19958</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-07-25T07:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SubQuery Equivalent in QlikScript?</title>
      <link>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134255#M19959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thx @&lt;SPAN class="j-post-author"&gt;&lt;STRONG&gt;&lt;A href="https://community.qlik.com/people/gwassenaar"&gt;gwassenaar&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; for the feedback, I'll def. avoid the same mistake while posting my future question&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2016 09:48:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/SQL-SubQuery-Equivalent-in-QlikScript/m-p/1134255#M19959</guid>
      <dc:creator />
      <dc:date>2016-07-25T09:48:50Z</dc:date>
    </item>
  </channel>
</rss>

