<?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: Need help with data manipulation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986635#M336464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on swuehl script but joining with a temp table in the 2nd join (with less records maybe performance is better)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: One field name is changed 'cause I was doing a sample.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Nov 2015 15:30:33 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2015-11-12T15:30:33Z</dc:date>
    <item>
      <title>Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986628#M336457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on something where I know I can get it done through work around, but was wondering if there is a better way to do it. Please note that this is just a sample and the actual data is huge + the script needs to be dynamic to handle the requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID, FIELD1, MONTHYEAR, VALUE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, ABC,&amp;nbsp; 11/01/2015, 10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, ABC, 12/01/2015, 11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, ABC, 01/01/2016, 12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, ABC, 02/01/2016, 11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, ABC, 03/01/2016, 12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, DEF, 11/01/2015, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, DEF, 12/01/2015, 4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, GHI, 11/01/2015, 8&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, GHI, 12/01/2015, 9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, ABC,&amp;nbsp; 11/01/2015, 10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, ABC, 12/01/2015, 11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, ABC, 01/01/2016, 12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, ABC, 02/01/2016, 11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, ABC, 03/01/2016, 12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, ABC, 04/01/2016, 16&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, DEF, 11/01/2015, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, DEF, 12/01/2015, 4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, GHI, 11/01/2015, 8&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, GHI, 12/01/2015, 9&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching the expected output file with the sample application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update: Can you guys have a look please &lt;A href="https://community.qlik.com/qlik-users/15823"&gt;swuehl&lt;/A&gt;‌‌, &lt;A href="https://community.qlik.com/qlik-users/61824"&gt;MarcoWedel&lt;/A&gt;‌, &lt;A href="https://community.qlik.com/qlik-users/23109"&gt;jagan&lt;/A&gt;‌ &lt;A href="https://community.qlik.com/qlik-users/120618"&gt;MRKachhiaIMP&lt;/A&gt;‌ &lt;A href="https://community.qlik.com/qlik-users/13229"&gt;jontydkpi&lt;/A&gt;‌ &lt;A href="https://community.qlik.com/qlik-users/21667"&gt;cleveranjos&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 14:09:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986628#M336457</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-12T14:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986629#M336458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny, maybe you have already think (and discarted) this option as a workaround:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1- Create a Key with ID, FIELD1 and MONTHYEAR in your original table&lt;/P&gt;&lt;P&gt;2 - Create a temp table with the VALUE of the max MONTHYEAR for each ID and FIELD1&lt;/P&gt;&lt;P&gt;3 - Create a 2nd temp table with all the possible relations between ID, FIELD1 and MONTHYEAR... This is the one that can cause performance issues for huge data, maybe you can limit combinations if you can be sure that, if an ID &amp;amp; FIELD1 has value for a date, it has values in previous dates.&lt;/P&gt;&lt;P&gt;4 - Join to this table the values from the first temp table using ID and FIELD1&lt;/P&gt;&lt;P&gt;5 - Concatenate the result table to the first table checking that the key doesn't exists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 14:35:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986629#M336458</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-11-12T14:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986630#M336459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/RubenMarin"&gt;Ruben&lt;/A&gt;‌ thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did have a similar idea, but like you said it could be a performance killer. I am looking for an efficient way to do this if possible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 14:39:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986630#M336459</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-12T14:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986631#M336460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET DATEFORMAT = 'MM/DD/YYYY';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD * Inline [&lt;/P&gt;&lt;P&gt;ID, FIELD1, MONTHYEAR, VALUE&lt;/P&gt;&lt;P&gt;1, ABC,&amp;nbsp; 11/01/2015, 10&lt;/P&gt;&lt;P&gt;1, ABC, 12/01/2015, 11&lt;/P&gt;&lt;P&gt;1, ABC, 01/01/2016, 12&lt;/P&gt;&lt;P&gt;1, ABC, 02/01/2016, 11&lt;/P&gt;&lt;P&gt;1, ABC, 03/01/2016, 12&lt;/P&gt;&lt;P&gt;1, DEF, 11/01/2015, 5&lt;/P&gt;&lt;P&gt;1, DEF, 12/01/2015, 4&lt;/P&gt;&lt;P&gt;1, GHI, 11/01/2015, 8&lt;/P&gt;&lt;P&gt;1, GHI, 12/01/2015, 9&lt;/P&gt;&lt;P&gt;2, ABC,&amp;nbsp; 11/01/2015, 10&lt;/P&gt;&lt;P&gt;2, ABC, 12/01/2015, 11&lt;/P&gt;&lt;P&gt;2, ABC, 01/01/2016, 12&lt;/P&gt;&lt;P&gt;2, ABC, 02/01/2016, 11&lt;/P&gt;&lt;P&gt;2, ABC, 03/01/2016, 12&lt;/P&gt;&lt;P&gt;2, ABC, 04/01/2016, 16&lt;/P&gt;&lt;P&gt;2, DEF, 11/01/2015, 5&lt;/P&gt;&lt;P&gt;2, DEF, 12/01/2015, 4&lt;/P&gt;&lt;P&gt;2, GHI, 11/01/2015, 8&lt;/P&gt;&lt;P&gt;2, GHI, 12/01/2015, 9&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOIN (Table)&lt;/P&gt;&lt;P&gt;LOAD ID, FIELD1, Max(MONTHYEAR) as MaxIDField&lt;/P&gt;&lt;P&gt;Resident Table&lt;/P&gt;&lt;P&gt;GROUP BY ID, FIELD1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOIN (Table)&lt;/P&gt;&lt;P&gt;LOAD ID, Max(MONTHYEAR) as MaxID&lt;/P&gt;&lt;P&gt;Resident Table &lt;/P&gt;&lt;P&gt;GROUP BY ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE (Table)&lt;/P&gt;&lt;P&gt;LOAD ID, FIELD1, Date(AddMonths(MONTHYEAR,iterno())) as MONTHYEAR, VALUE, MaxIDField, MaxID&lt;/P&gt;&lt;P&gt;Resident Table&lt;/P&gt;&lt;P&gt;WHILE&amp;nbsp; AddMonths(MONTHYEAR,iterno()) &amp;lt;= MaxID and MONTHYEAR = MaxIDField;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// DROP FIELDS MaxIDField, MaxID;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 14:57:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986631#M336460</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-11-12T14:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986632#M336461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Stefan. Let me implement this in my original script and see how it works. For the sample it did work as desired.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:02:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986632#M336461</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-12T15:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986633#M336462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could perform slightly better using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;WHILE&amp;nbsp; MONTHYEAR = MaxIDField&amp;nbsp; AND AddMonths(MONTHYEAR,iterno()) &amp;lt;= MaxID ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:10:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986633#M336462</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-11-12T15:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986634#M336463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked like a charm. Thanks Stefan and Ruben for your advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ruben you advice might have worked the same way, but I did not have the script and I was too scared to work on it on my own. I still need to figure out what Stefan's script it doing, but it works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will probably on the weekend to figure what exactly it did.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once again, thanks guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:28:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986634#M336463</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-12T15:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986635#M336464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on swuehl script but joining with a temp table in the 2nd join (with less records maybe performance is better)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: One field name is changed 'cause I was doing a sample.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:30:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986635#M336464</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-11-12T15:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986636#M336465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My initial proposal was slightly different from swuehl's, his proposal is better and clever so he deserves the 'correct answer'&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:33:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986636#M336465</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-11-12T15:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986637#M336466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If Sunny finds some time to test, would be interesting to see some numbers based on his data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are going to test Ruben's solution, I think the second JOIN can be slightly improved by LOADing data from TempTable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOIN (TempTable)&lt;/P&gt;&lt;P&gt;LOAD ID, Max(&lt;STRONG&gt;MaxMONTHYEAR&lt;/STRONG&gt;) as MaxID&lt;/P&gt;&lt;P&gt;Resident &lt;STRONG&gt;TempTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;GROUP BY ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: Well, probably doing this before the LEFT JOIN of the complete Table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTable:&lt;/P&gt;&lt;P&gt;LOAD ID, FIELD1, Date(Max(MONTHYEAR)) as MaxMONTHYEAR Resident Table Group By ID, FIELD1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;JOIN (TempTable)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD ID, Max(&lt;STRONG&gt;MaxMONTHYEAR&lt;/STRONG&gt;) as MaxID&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Resident &lt;STRONG&gt;TempTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;GROUP BY ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join (TempTable)&lt;/P&gt;&lt;P&gt;LOAD ID, FIELD1, MONTHYEAR as MaxMONTHYEAR, VALUE Resident Table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:41:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986637#M336466</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-11-12T15:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986638#M336467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can definitely run some test's, but at a later time. Right now I am time crunched and will use Stefan's script as I have already implemented that and it seems to work &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But thanks guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:44:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986638#M336467</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-12T15:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with data manipulation</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986639#M336468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was intended to do that way but I forgot to change it. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2015 15:46:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-data-manipulation/m-p/986639#M336468</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-11-12T15:46:04Z</dc:date>
    </item>
  </channel>
</rss>

