<?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: Compare Previous Values and create new field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584557#M597790</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;T2:
LOAD StartTime,
	 Bin,
	 Emp_ID,
	 If(Emp_ID = Previous(Emp_ID) and Bin &amp;lt;&amp;gt; Previous(Bin) and StartTime-Previous(StartTime) &amp;lt;= 2000, Previous(StartTime), StartTime) as NewColumn
Resident T1
Order by Emp_ID;&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 24 May 2019 14:48:56 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-05-24T14:48:56Z</dc:date>
    <item>
      <title>Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584519#M597788</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm working on a requirement where i have to look at previous rows and create a new column. Please see below example and attached qvw.&lt;/P&gt;&lt;P&gt;If(Emp_ID=Previous(Emp_ID) and Bin &amp;lt;&amp;gt; Previous(Bin) and StartTime-Previous(StartTime) &amp;lt;= 2000, Previous(StartTime), StartTime) as NewColumn;&lt;/P&gt;&lt;P&gt;Here is example:&lt;/P&gt;&lt;P&gt;StartTime,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bin,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Emp_ID&lt;/P&gt;&lt;P&gt;27011,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SINGLES-BULK-082,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;BR /&gt;27051,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SINGLES-BULK-055,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;U&gt;&lt;STRONG&gt;Output would be,&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;StartTime,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bin,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Emp_ID,&amp;nbsp; &amp;nbsp;&amp;nbsp;NewColumn&lt;/P&gt;&lt;P&gt;27011,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SINGLES-BULK-082,&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; 27011&lt;BR /&gt;27051,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SINGLES-BULK-055,&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;27011&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be highly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:28:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584519#M597788</guid>
      <dc:creator>markgraham123</dc:creator>
      <dc:date>2024-11-16T03:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584555#M597789</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 14:42:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584555#M597789</guid>
      <dc:creator>markgraham123</dc:creator>
      <dc:date>2019-05-24T14:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584557#M597790</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;T2:
LOAD StartTime,
	 Bin,
	 Emp_ID,
	 If(Emp_ID = Previous(Emp_ID) and Bin &amp;lt;&amp;gt; Previous(Bin) and StartTime-Previous(StartTime) &amp;lt;= 2000, Previous(StartTime), StartTime) as NewColumn
Resident T1
Order by Emp_ID;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 May 2019 14:48:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584557#M597790</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-24T14:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584566#M597791</link>
      <description>&lt;P&gt;Sunny,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is only picking first row and changing the value.&lt;/P&gt;&lt;P&gt;I want the values to be changed for all the values of the particular 'Bin'.&lt;/P&gt;&lt;P&gt;Please see attached.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 15:00:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584566#M597791</guid>
      <dc:creator>markgraham123</dc:creator>
      <dc:date>2019-05-24T15:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584581#M597792</link>
      <description>&lt;P&gt;May be this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;T2:
LOAD RowNo() as RowNum,
	 StartTime,
	 Bin,
	 Emp_ID,
	 If(Emp_ID = Previous(Emp_ID),
	 	If(Bin = Previous(Bin), Peek('NewColumn'),
	 		If(StartTime-Previous(StartTime) &amp;lt;= 2000, Previous(StartTime), StartTime)), StartTime) as NewColumn
Resident T1
Order by Emp_ID;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 May 2019 15:14:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584581#M597792</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-24T15:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584597#M597793</link>
      <description>&lt;P&gt;Sunny,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is perfect. Meets my requirement.&lt;/P&gt;&lt;P&gt;What if i want to improvize this so that, the logic only wants to group 2 timings and give previous time for 2nd one.&lt;/P&gt;&lt;P&gt;Once it reaches 3rd time, my logic should treat 3rd time as new timing and look for 4th timing and group it to 3rd timing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 15:32:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584597#M597793</guid>
      <dc:creator>markgraham123</dc:creator>
      <dc:date>2019-05-24T15:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584600#M597794</link>
      <description>&lt;P&gt;You would have to elaborate on this with an example and it's output&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 15:45:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584600#M597794</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-24T15:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Previous Values and create new field</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584649#M597795</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp; &amp;nbsp; I apologize for the confusion...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my sample data and expected output:&lt;/P&gt;&lt;P&gt;1. I sort it by Emp_ID and StartTime.&lt;/P&gt;&lt;P&gt;If(Emp_ID = Previous(Emp_ID),&lt;BR /&gt;If(Bin = Previous(Bin), Peek('NewColumn'),&lt;BR /&gt;If(StartTime-Previous(StartTime) &amp;lt;= 2000, Previous(StartTime), StartTime)), StartTime) as NewColumn&lt;/P&gt;&lt;P&gt;I can apply above logic only for 2 items for one timing. Once i reach 3rd item, i have to start fresh group with 3rd timing and run the same logic.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;StartTime&lt;/TD&gt;&lt;TD&gt;Bin&lt;/TD&gt;&lt;TD&gt;Emp_ID&lt;/TD&gt;&lt;TD&gt;NewColumn&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27011&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-082&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;27011&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27948&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-085&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993366"&gt;27011 (Since i reached 2 items, i will start logic from next timing now)&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29308&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-091&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF6600"&gt;29308&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29804&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-066&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF6600"&gt;29308&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;31604&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-039&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;31604&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;35885&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-095&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;35885&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36444&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-063&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;35885&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;37586&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-097&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#008000"&gt;37586&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;38016&lt;/TD&gt;&lt;TD&gt;SINGLES-BULK-090&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#008000"&gt;37586&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 24 May 2019 19:27:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-Previous-Values-and-create-new-field/m-p/1584649#M597795</guid>
      <dc:creator>markgraham123</dc:creator>
      <dc:date>2019-05-24T19:27:48Z</dc:date>
    </item>
  </channel>
</rss>

