<?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 Re: To Control Sorting while Loading Data i.e in the Load Statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520784#M748500</link>
    <description>But what happens if your data is like this&lt;BR /&gt;123 12/13/2018 0 15&lt;BR /&gt;123 12/13/2018 1 27.5&lt;BR /&gt;123 12/14/2018 0 28&lt;BR /&gt;123 12/14/2018 1 30&lt;BR /&gt;&lt;BR /&gt;or once changed to 1, it will never become 0 again?&lt;BR /&gt;</description>
    <pubDate>Fri, 14 Dec 2018 01:48:43 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-12-14T01:48:43Z</dc:date>
    <item>
      <title>To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520343#M748493</link>
      <description>I am using a Previous() function for computing variance. The computation is dependent on the sorting sequence of the data being Loaded. The order by clause is not yielding the correct results as it is sorting it the right way on the o/p and not while loading the data. TIA, Shannoy</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520343#M748493</guid>
      <dc:creator>shannoypaul</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520345#M748494</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;a bit more information would be useful. Maybe a code snippet?&lt;/P&gt;&lt;P&gt;A note - if you are loading from a qvd, load first into a temporary table, then do a resident load with your sort order applied.&lt;/P&gt;&lt;P&gt;Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 11:17:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520345#M748494</guid>
      <dc:creator>marcus_malinow</dc:creator>
      <dc:date>2018-12-13T11:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520351#M748495</link>
      <description>&lt;P&gt;Hi Paul,&lt;/P&gt;&lt;P&gt;Try by taking a resident table and sort the values. Use the order by statement ASC or DESC.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 11:22:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520351#M748495</guid>
      <dc:creator>mohan_1105</dc:creator>
      <dc:date>2018-12-13T11:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520379#M748496</link>
      <description>Where exactly are you pulling your data from? and what do you mean when you say this "it is sorting it the right way on the o/p and not while loading the data"? Sorting the right way on the o/p? What is o/p here? front end?</description>
      <pubDate>Thu, 13 Dec 2018 12:05:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520379#M748496</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-13T12:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520693#M748497</link>
      <description>&lt;P&gt;I am pulling from a qvd.&lt;/P&gt;&lt;P&gt;I will break it down to 2 parts&lt;/P&gt;&lt;P&gt;1. Current Setup&lt;/P&gt;&lt;P&gt;SortedTable:&lt;/P&gt;&lt;P&gt;Load Key, Created Date, Value, Flag From &lt;STRONG&gt;ResidentTable&lt;/STRONG&gt; Order by Key, Created Date, Flag &lt;STRONG&gt;asc&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Store SortedTable in Sorted.qvd&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ComputeTable:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Value - &lt;STRONG&gt;Previous&lt;/STRONG&gt;(Value) as Compute&lt;/P&gt;&lt;P&gt;From Sorted.qvd&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The catch is Previous(&lt;/STRONG&gt;Value&lt;STRONG&gt;)&amp;nbsp; can have 2 possibilities i.e. Flag can be 0 and/or 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Required Approach:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Previous(Value) &lt;/STRONG&gt;to be considered should have&lt;STRONG&gt; Flag =1 for cases where there are 2 options&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;a. Flag&amp;nbsp; for the previous row is 0 or 1 - No Problem as this is a distinct value&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;b Flag is 0 and 1 - Consider previous row with flag = 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;**&amp;nbsp;&lt;/STRONG&gt;Hence asc ordering done but&amp;nbsp;&lt;/P&gt;&lt;P&gt;ComputeTable data when checked in the UI is sorted correctly (&lt;STRONG&gt;Flag asc)&amp;nbsp; but the Compute value is of the record for Flag = 0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hence I inferred&amp;nbsp;that the internal loading of a table is not affected by&lt;STRONG&gt; order by clause&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 19:12:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520693#M748497</guid>
      <dc:creator>shannoypaul</dc:creator>
      <dc:date>2018-12-13T19:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520697#M748498</link>
      <description>Are you saying that Key and Created Date can repeat with Flag = 0 and Flag = 1? and you only want to pick Previous(Value) if Previous(Flag) = 1?&lt;BR /&gt;&lt;BR /&gt;Question, can you have max 2 rows for a combination of Key and Created Date or can you have 3+ rows like this&lt;BR /&gt;&lt;BR /&gt;Key Created Date Flag Value&lt;BR /&gt;123 12/13/2018 0 10&lt;BR /&gt;123 12/13/2018 0 20&lt;BR /&gt;123 12/13/2018 1 30&lt;BR /&gt;123 12/13/2018 1 25</description>
      <pubDate>Thu, 13 Dec 2018 19:22:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520697#M748498</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-13T19:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520756#M748499</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;&lt;P&gt;3+ rows however I have got it to only 2 cases by grouping it with the key "Created Date,Key, Flag"&lt;/P&gt;&lt;P&gt;Key Created Date Flag Avg. Value&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123 12/13/2018 0 15&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;123 12/13/2018 1 27.5&lt;BR /&gt;123 12/14/2018 1 30&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Can be an averaged value or a single line)&lt;BR /&gt;&lt;/SPAN&gt;For the 3rd Row I would want to compute 30-27.5 by using the previous() Function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 22:39:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520756#M748499</guid>
      <dc:creator>shannoypaul</dc:creator>
      <dc:date>2018-12-13T22:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520784#M748500</link>
      <description>But what happens if your data is like this&lt;BR /&gt;123 12/13/2018 0 15&lt;BR /&gt;123 12/13/2018 1 27.5&lt;BR /&gt;123 12/14/2018 0 28&lt;BR /&gt;123 12/14/2018 1 30&lt;BR /&gt;&lt;BR /&gt;or once changed to 1, it will never become 0 again?&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Dec 2018 01:48:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520784#M748500</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-14T01:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520791#M748501</link>
      <description>&lt;P&gt;I have put a check to compare the Key and the Created Date, if the Key and Created Date is same it will iterate to the Previous(Previous(Value)):&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123 12/13/2018 0 15&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;123 12/13/2018 1 27.5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;123 12/14/2018 0 28&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;123 12/14/2018 1 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Or in this case you can assume that for Flag = 0 we need not do any computation where as for Flag = 1&lt;/P&gt;&lt;P&gt;30 - 27.5 i .e Row(4) - Row(2) because Row(2) has Flag = 1&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 02:59:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520791#M748501</guid>
      <dc:creator>shannoypaul</dc:creator>
      <dc:date>2018-12-14T02:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520792#M748502</link>
      <description>&lt;P&gt;All checks are in place the only hurdle is to pick the previous row with Flag=1 for computation &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks for asking!&lt;/P&gt;&lt;P&gt;P.S.&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;, you were the one who helped me build that but it was on a different thread.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 03:01:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1520792#M748502</guid>
      <dc:creator>shannoypaul</dc:creator>
      <dc:date>2018-12-14T03:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: To Control Sorting while Loading Data i.e in the Load Statement</title>
      <link>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1521021#M748503</link>
      <description>&lt;P&gt;Something like this&lt;/P&gt;&lt;PRE&gt;Table:
LOAD * INLINE [
    Key, Created Date, Flag, Value
    123, 12/13/2018, 0, 15
    123, 12/13/2018, 1, 27.5
    123, 12/14/2018, 0, 28
    123, 12/14/2018, 1, 30
];

FinalTable:
LOAD *,
	 0 as New_Value
Resident Table
Where Flag = 0;

Concatenate (FinalTable)
LOAD *,
	 If(Key = Previous(Key), Value - Peek('Value'), 0) as New_Value;
LOAD *
Resident Table
Where Flag = 1
Order By Key, [Created Date];

DROP Table Table;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Dec 2018 12:09:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/To-Control-Sorting-while-Loading-Data-i-e-in-the-Load-Statement/m-p/1521021#M748503</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-12-14T12:09:42Z</dc:date>
    </item>
  </channel>
</rss>

