<?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 Autogenerating records for dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425354#M158432</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my script I have a portion that attempts to create records in a table that go back 1 year from the next month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So today is 10/17/2012. I want to make a table with the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11/30/2012&lt;/P&gt;&lt;P&gt;10/31/2012&lt;/P&gt;&lt;P&gt;9/30/2012&lt;/P&gt;&lt;P&gt;8/31/2012&lt;/P&gt;&lt;P&gt;7/31/2012&lt;/P&gt;&lt;P&gt;6/30/2012&lt;/P&gt;&lt;P&gt;5/31/2012&lt;/P&gt;&lt;P&gt;4/30/2012&lt;/P&gt;&lt;P&gt;3/31/2012&lt;/P&gt;&lt;P&gt;2/29/2012&lt;/P&gt;&lt;P&gt;1/31/2012&lt;/P&gt;&lt;P&gt;12/31/2011&lt;/P&gt;&lt;P&gt;11/30/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It needs to always be at the end of the month since that is my rollover date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I sort of have it, but I think my logic for jumping forward during my LOAD is the issue. Problem is, I don't know what my other option would be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the code below, varSRMaxCreateDate is just an active variable that gets the latest record date in the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;LET RollMax = Num(MonthEnd(varSRMaxCreateDate));&lt;/P&gt;&lt;P&gt;LET RollMin = Num(MonthEnd(Addmonths(varSRMaxCreateDate,-12)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;trace RollMin: $(RollMin);&lt;/P&gt;&lt;P&gt;trace RollMax: $(RollMax);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RollingCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Date($(RollMin) + RecNo() * 30) AS RollDate,&lt;/P&gt;&lt;P&gt;1 as RollKey&lt;/P&gt;&lt;P&gt;AUTOGENERATE 13;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the resulting data. You can see how not all months are at the ending date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="94"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="94"&gt;RollDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;12/1/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;12/31/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;1/30/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;2/29/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;3/30/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;4/29/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;5/29/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;6/28/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;7/28/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;8/27/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;9/26/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;10/26/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;11/25/2012&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2012 19:42:08 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-17T19:42:08Z</dc:date>
    <item>
      <title>Autogenerating records for dates</title>
      <link>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425354#M158432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my script I have a portion that attempts to create records in a table that go back 1 year from the next month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So today is 10/17/2012. I want to make a table with the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11/30/2012&lt;/P&gt;&lt;P&gt;10/31/2012&lt;/P&gt;&lt;P&gt;9/30/2012&lt;/P&gt;&lt;P&gt;8/31/2012&lt;/P&gt;&lt;P&gt;7/31/2012&lt;/P&gt;&lt;P&gt;6/30/2012&lt;/P&gt;&lt;P&gt;5/31/2012&lt;/P&gt;&lt;P&gt;4/30/2012&lt;/P&gt;&lt;P&gt;3/31/2012&lt;/P&gt;&lt;P&gt;2/29/2012&lt;/P&gt;&lt;P&gt;1/31/2012&lt;/P&gt;&lt;P&gt;12/31/2011&lt;/P&gt;&lt;P&gt;11/30/2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It needs to always be at the end of the month since that is my rollover date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I sort of have it, but I think my logic for jumping forward during my LOAD is the issue. Problem is, I don't know what my other option would be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the code below, varSRMaxCreateDate is just an active variable that gets the latest record date in the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;LET RollMax = Num(MonthEnd(varSRMaxCreateDate));&lt;/P&gt;&lt;P&gt;LET RollMin = Num(MonthEnd(Addmonths(varSRMaxCreateDate,-12)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;trace RollMin: $(RollMin);&lt;/P&gt;&lt;P&gt;trace RollMax: $(RollMax);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RollingCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Date($(RollMin) + RecNo() * 30) AS RollDate,&lt;/P&gt;&lt;P&gt;1 as RollKey&lt;/P&gt;&lt;P&gt;AUTOGENERATE 13;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the resulting data. You can see how not all months are at the ending date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="94"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="94"&gt;RollDate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;12/1/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;12/31/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;1/30/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;2/29/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;3/30/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;4/29/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;5/29/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;6/28/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;7/28/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;8/27/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;9/26/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="17" style="border-top: none;"&gt;10/26/2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="17" style="border-top: none;"&gt;11/25/2012&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 19:42:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425354#M158432</guid>
      <dc:creator />
      <dc:date>2012-10-17T19:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Autogenerating records for dates</title>
      <link>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425355#M158433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;date(daystart(addmonths($(RollMin),recno()-1,1))) as RollDate&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 19:52:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425355#M158433</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2012-10-17T19:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Autogenerating records for dates</title>
      <link>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425356#M158434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is beautiful! It worked perfectly!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 19:56:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Autogenerating-records-for-dates/m-p/425356#M158434</guid>
      <dc:creator />
      <dc:date>2012-10-17T19:56:03Z</dc:date>
    </item>
  </channel>
</rss>

