<?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 Creating a new Previous Data Column in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Creating-a-new-Previous-Data-Column/m-p/1798131#M8767</link>
    <description>&lt;P&gt;Hi! New poster here. I have a dataset that is updated weekly in the database where the new data is appended under the old data with the last column showing the date it was added.&lt;/P&gt;&lt;P&gt;So for instance&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Date&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&lt;/P&gt;&lt;P&gt;We need to create a new column for each ID that is equal to the prior week/month value of some of the columns. For example have a column called Category_Cd and we want to track ID's where the Cd has changed from week to week and from month to month. An example of how it would look below.&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cat_Cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Prev_Cat&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&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; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&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; &amp;nbsp; A&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;&lt;P&gt;I am confused as to how to build this out in the load editor. I have a general idea how to do it using SQL logic but I feel like it is a case where it is very different from what Qlik offers. Unfortunately I cannot give a test set for everyone here as m Qlik access is on the client side and I cannot pull anything off there. Does anyone have any insight?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Dec 2021 14:57:54 GMT</pubDate>
    <dc:creator>eganba07</dc:creator>
    <dc:date>2021-12-23T14:57:54Z</dc:date>
    <item>
      <title>Creating a new Previous Data Column</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Creating-a-new-Previous-Data-Column/m-p/1798131#M8767</link>
      <description>&lt;P&gt;Hi! New poster here. I have a dataset that is updated weekly in the database where the new data is appended under the old data with the last column showing the date it was added.&lt;/P&gt;&lt;P&gt;So for instance&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Date&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&lt;/P&gt;&lt;P&gt;We need to create a new column for each ID that is equal to the prior week/month value of some of the columns. For example have a column called Category_Cd and we want to track ID's where the Cd has changed from week to week and from month to month. An example of how it would look below.&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cat_Cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Prev_Cat&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&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; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&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; &amp;nbsp; A&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/7/2021&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;&lt;P&gt;I am confused as to how to build this out in the load editor. I have a general idea how to do it using SQL logic but I feel like it is a case where it is very different from what Qlik offers. Unfortunately I cannot give a test set for everyone here as m Qlik access is on the client side and I cannot pull anything off there. Does anyone have any insight?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 14:57:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Creating-a-new-Previous-Data-Column/m-p/1798131#M8767</guid>
      <dc:creator>eganba07</dc:creator>
      <dc:date>2021-12-23T14:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Previous Data Column</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Creating-a-new-Previous-Data-Column/m-p/1801362#M8826</link>
      <description>&lt;P&gt;Perfect use case for the Qlik Script function PREVIOUS. Just be sure that you sort the data correctly so it's in the order you wish.&amp;nbsp;&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense/February2021/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/Previous.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense/February2021/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/Previous.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;ID, Date , Cat_Cd&lt;BR /&gt;1, 4/1/2021 , A&lt;BR /&gt;2, 4/1/2021 , A&lt;BR /&gt;1, 4/7/2021 , B&lt;BR /&gt;2, 4/7/2021 , C&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;Join (Data)&lt;BR /&gt;Load&lt;BR /&gt;ID,&lt;BR /&gt;Date,&lt;BR /&gt;Cat_Cd,&lt;BR /&gt;If (&lt;STRONG&gt;Previous&lt;/STRONG&gt;(ID) = ID, &lt;STRONG&gt;Previous&lt;/STRONG&gt;(Cat_Cd), NULL()) as Previous_Cat_Cd&lt;BR /&gt;Resident Data&lt;BR /&gt;Order by ID, Date;&lt;/P&gt;&lt;P&gt;Yields the following results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Previous.png" style="width: 316px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/53385i1559D5D412B323CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Previous.png" alt="Previous.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 14:18:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Creating-a-new-Previous-Data-Column/m-p/1801362#M8826</guid>
      <dc:creator>Dalton_Ruer</dc:creator>
      <dc:date>2021-04-21T14:18:19Z</dc:date>
    </item>
  </channel>
</rss>

