<?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 Group by and Order by in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440330#M796043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can any one explain with the help of suitable example me where and in which condition we have to use Group by and Order by in qlikview load script.&lt;/P&gt;&lt;P&gt;I have sample raw data in excel attached below.so on that raw data in which scenario we can apply group by and order by in load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>dhavalvyas</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Group by and Order by</title>
      <link>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440330#M796043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can any one explain with the help of suitable example me where and in which condition we have to use Group by and Order by in qlikview load script.&lt;/P&gt;&lt;P&gt;I have sample raw data in excel attached below.so on that raw data in which scenario we can apply group by and order by in load script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440330#M796043</guid>
      <dc:creator>dhavalvyas</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and Order by</title>
      <link>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440331#M796044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems something wrong with Attachment please can you attach again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mukram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2017 18:30:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440331#M796044</guid>
      <dc:creator>mdmukramali</dc:creator>
      <dc:date>2017-12-20T18:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and Order by</title>
      <link>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440332#M796045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as Mohammed wrote, the attach is wrong.&lt;/P&gt;&lt;P&gt;with a order by load you can order your datas by fields, expample:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value&lt;/P&gt;&lt;P&gt;from source&lt;/P&gt;&lt;P&gt;order by CustomerNo, OrderDate DESC;&lt;/P&gt;&lt;P&gt;this will order your datas&lt;/P&gt;&lt;P&gt;first by Customer No ascending,&lt;/P&gt;&lt;P&gt;second by Order Date descending&lt;/P&gt;&lt;P&gt;so you have the newest order date for each customer in the first line.&lt;/P&gt;&lt;P&gt;How to use:&lt;/P&gt;&lt;P&gt;For example in most ERP systems (like SAP) there is no daily order input value. you have a orderno with create date and edit date (the last edit date) but not for every edit date a separate line.&lt;/P&gt;&lt;P&gt;So you can store your order sets within a datefield today() and compare against the last entry.&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; snaphot as Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(OrderNo = previous(OrderNo),value-previous(value) , value) as value,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; other fields.&lt;/P&gt;&lt;P&gt;If you have order your datas ba OrderNo and snapshot date descending you con compare that the order no in actual line is equal to order no in line above so the actual order value is actual - last entry = delta. Otherwise (if OrderNo unequal to previous OrderNo) there is a new order line).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by you need within aggregaations in script.&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(OrderDate) as LastOrderDate&lt;/P&gt;&lt;P&gt;resident source&lt;/P&gt;&lt;P&gt;group by CustomerNo;&lt;/P&gt;&lt;P&gt;this script wil create a table with CustomerNo and the max (the last) order date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps without your own datas.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Dec 2017 21:07:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Group-by-and-Order-by/m-p/1440332#M796045</guid>
      <dc:creator>martinpohl</dc:creator>
      <dc:date>2017-12-20T21:07:57Z</dc:date>
    </item>
  </channel>
</rss>

