<?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: Load Script - create new column values based on existing date columns in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141963#M374039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siva - I have uploaded a sample which incorporates the suggested approach from Mindaugas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Sep 2016 19:13:27 GMT</pubDate>
    <dc:creator>martin_hamilton</dc:creator>
    <dc:date>2016-09-05T19:13:27Z</dc:date>
    <item>
      <title>Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141959#M374035</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;I have a data table I am loading whereby I am first creating a new column which takes the Contract Start Date PLUS the Contract Tenure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I wish to do is look at this new date column and create a brand new column which states whether the customer is 'In Contract' or 'Out of Contract'. This would be based on whether the date was before or after the date of the load (I have created a variable vToday which I think I can incorporate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cant find anything in community which points me in the right direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advice/solutions out there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Martin Hamilton&#xD;
&#xD;
Added as a sample&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Sep 2016 20:20:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141959#M374035</guid>
      <dc:creator>martin_hamilton</dc:creator>
      <dc:date>2016-09-04T20:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141960#M374036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need a sample to show also not understanding whether load date is column which is already exsting in your data model. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may create a load date (dashboard refresh date) using below &lt;/P&gt;&lt;P&gt;Date( floor(ReloadTime()),'DD/MM/YYYY') as&amp;nbsp; LoadDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&amp;nbsp; create an if statement using the above date to generate in contract column and out of contract column&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2016 02:54:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141960#M374036</guid>
      <dc:creator>Siva_Sankar</dc:creator>
      <dc:date>2016-09-05T02:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141961#M374037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use IF statement in your data model like:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Contract Start Date]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,[Contract Tenure]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,IF(Today() &amp;lt;= &lt;SPAN style="font-size: 13.3333px;"&gt;[Contract Start Date] + &lt;SPAN style="font-size: 13.3333px;"&gt;[Contract Tenure], &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'In Contract', &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'Out of Contract') as [Is in contract]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;From &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; line-height: 1.5em;"&gt;Source;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2016 05:22:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141961#M374037</guid>
      <dc:creator>MindaugasBacius</dc:creator>
      <dc:date>2016-09-05T05:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141962#M374038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi Mindaugas - I have added the logic you provided into my load script but it doesnt seem to be taking into consideration the actual contract end date but looks at the contact start date. Can you take a look and see where I am going wrong? Because I am creating a new contract end date i was sure whether it was possible to produce a look up as part of the load to generate the new column?&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2016 19:12:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141962#M374038</guid>
      <dc:creator>martin_hamilton</dc:creator>
      <dc:date>2016-09-05T19:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141963#M374039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siva - I have uploaded a sample which incorporates the suggested approach from Mindaugas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2016 19:13:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141963#M374039</guid>
      <dc:creator>martin_hamilton</dc:creator>
      <dc:date>2016-09-05T19:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141964#M374040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Martin,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I noticed in your load script you used AddMonths to add the Contract Tenure to the Contract Start Date. I believe you need to do the same when using the formula from Mindaugas.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So, update the formula to be:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;IF(Today() &amp;lt;= AddMonths ([Contract Start Date],[Contract Tenure]) , 'In Contract', 'Out of Contract') as [Is in contract]&lt;/P&gt;&lt;P&gt;From Source&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the AddMonths, the formula is probably adding the Tenure as days instead of months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 02:18:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141964#M374040</guid>
      <dc:creator />
      <dc:date>2016-09-06T02:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - create new column values based on existing date columns</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141965#M374041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats exactly what it was doing! thanks Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 08:58:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Script-create-new-column-values-based-on-existing-date/m-p/1141965#M374041</guid>
      <dc:creator>martin_hamilton</dc:creator>
      <dc:date>2016-09-06T08:58:04Z</dc:date>
    </item>
  </channel>
</rss>

