<?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: How to create a monthly qvd based on date field in data? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653576#M731202</link>
    <description>&lt;P&gt;Hi . i try to run with your script, but turns out has token error.&lt;/P&gt;&lt;P&gt;This is my original script, which are working fine. but, when i changed to your script, it didnt work out and has error. How can i apply your script to my script?&lt;/P&gt;&lt;P&gt;Month:&lt;BR /&gt;Load Distinct&lt;BR /&gt;num(Month(BIOMETRIC_CTOS_DT), '00')as NumMonth&lt;BR /&gt;From&lt;BR /&gt;D:\DAILY_REPORT_HIST_1.qvd(qvd);&lt;/P&gt;&lt;P&gt;Let vCount = noofrows('Month');&lt;/P&gt;&lt;P&gt;For i=0 to $(vCount) -1&lt;BR /&gt;Let y = If($(x) = 0, 0, $(x) * -1);&lt;BR /&gt;Let vMonth = peek('NumMonth',$(i),'Month');&lt;BR /&gt;Let vYYYY = Year(MonthStart(AddMonths((Date(Today (), 'DD/MM/YYYY')), $(y))));&lt;BR /&gt;&lt;BR /&gt;$(vMonth):&lt;/P&gt;&lt;P&gt;Load * from&lt;BR /&gt;D:\HIST.qvd(qvd)&lt;BR /&gt;where Month(BIOMETRIC_DT) = $(vMonth);&lt;/P&gt;&lt;P&gt;Store $(vMonth) into D:\DAILY_REPORT_$(vYYYY)$(vMonth).qvd;&lt;/P&gt;&lt;P&gt;Drop Table $(vMonth);&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2019 12:48:38 GMT</pubDate>
    <dc:creator>jim_chan</dc:creator>
    <dc:date>2019-12-03T12:48:38Z</dc:date>
    <item>
      <title>How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653565#M731200</link>
      <description>&lt;P&gt;Hello there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i&amp;nbsp; came through a script as below&amp;nbsp;to create a monthly qvd based on date field in data. But i start wondering&amp;nbsp;&lt;/P&gt;&lt;P&gt;the vMonth actually give me a a month number from 01-12. for 2019 this year should be no problem producing out the qvd by 201901- until 201912.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what if next year 2020, my data file comes with 202001. will the script below inteliigently able to help e split the file to 201901 and 202001 qvd?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample script would be like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Month:&lt;/P&gt;&lt;P&gt;Load Distinct Month(Date) as MONTH From XYZ;&lt;/P&gt;&lt;P&gt;Let vCount = noofrows('Month');&lt;/P&gt;&lt;P&gt;For i=0 to $(vCount) -1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Let vMonth = peek('MONTH',$(i),'Month');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vMonth):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load * from XYZ where Month(Date) = $(vMonth);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Store $(vMonth) into $(vMonth).qvd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Drop Table $(vMonth);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:47:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653565#M731200</guid>
      <dc:creator>jim_chan</dc:creator>
      <dc:date>2024-11-16T01:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653574#M731201</link>
      <description>&lt;P&gt;No. You need to create at least a year variable. I also added YearMonth Variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Month:
Load Distinct Year(Date) &amp;amp; Month(Date) as YEARMONTH From XYZ;
Let vCount = noofrows('Month');
For i=0 to $(vCount) -1
     LET vYearMonth = peek('YEARMONTH ',$(i),'Month');
     LET vYear = left($(vYearMonth),4);
     LET vMonth = right($(vYearMonth),2);

     $(vYearMonth):
     Load * from XYZ where Month(Date) = $(vMonth) AND year(Date) = $(vYear );
     Store $(vYearMonth) into $(vYearMonth).qvd;
     Drop Table $(vYearMonth);
next i&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;tim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 12:31:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653574#M731201</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2019-12-03T12:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653576#M731202</link>
      <description>&lt;P&gt;Hi . i try to run with your script, but turns out has token error.&lt;/P&gt;&lt;P&gt;This is my original script, which are working fine. but, when i changed to your script, it didnt work out and has error. How can i apply your script to my script?&lt;/P&gt;&lt;P&gt;Month:&lt;BR /&gt;Load Distinct&lt;BR /&gt;num(Month(BIOMETRIC_CTOS_DT), '00')as NumMonth&lt;BR /&gt;From&lt;BR /&gt;D:\DAILY_REPORT_HIST_1.qvd(qvd);&lt;/P&gt;&lt;P&gt;Let vCount = noofrows('Month');&lt;/P&gt;&lt;P&gt;For i=0 to $(vCount) -1&lt;BR /&gt;Let y = If($(x) = 0, 0, $(x) * -1);&lt;BR /&gt;Let vMonth = peek('NumMonth',$(i),'Month');&lt;BR /&gt;Let vYYYY = Year(MonthStart(AddMonths((Date(Today (), 'DD/MM/YYYY')), $(y))));&lt;BR /&gt;&lt;BR /&gt;$(vMonth):&lt;/P&gt;&lt;P&gt;Load * from&lt;BR /&gt;D:\HIST.qvd(qvd)&lt;BR /&gt;where Month(BIOMETRIC_DT) = $(vMonth);&lt;/P&gt;&lt;P&gt;Store $(vMonth) into D:\DAILY_REPORT_$(vYYYY)$(vMonth).qvd;&lt;/P&gt;&lt;P&gt;Drop Table $(vMonth);&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 12:48:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653576#M731202</guid>
      <dc:creator>jim_chan</dc:creator>
      <dc:date>2019-12-03T12:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653579#M731203</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Month:
Load Distinct
num(Month(BIOMETRIC_CTOS_DT), '00')as NumMonth
From
D:\DAILY_REPORT_HIST_1.qvd(qvd);

Let vCount = noofrows('Month');

For i=0 to $(vCount) -1
Let y = If($(x) = 0, 0, $(x) * -1);
Let vMonth = peek('NumMonth',$(i),'Month');
Let vYYYY = Year(MonthStart(AddMonths((Date(Today (), 'DD/MM/YYYY')), $(y))));

$(vMonth):

Load * from
D:\HIST.qvd(qvd)
where Month(BIOMETRIC_DT) = $(vMonth) AND year(BIOMETRIC_DT) = $(vYYYY);

Store $(vMonth) into D:\DAILY_REPORT_$(vYYYY)$(vMonth).qvd;

Drop Table $(vMonth);

Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i just added this line&amp;nbsp; before the store statement:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND year(BIOMETRIC_DT) = $(vYYYY)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;tim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 12:53:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653579#M731203</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2019-12-03T12:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653582#M731204</link>
      <description>&lt;P&gt;This is perfect. By adding that year in where clause. will it solve my 201901 and 202001 issue??&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 12:59:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653582#M731204</guid>
      <dc:creator>jim_chan</dc:creator>
      <dc:date>2019-12-03T12:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653583#M731205</link>
      <description>&lt;P&gt;thats exactly what this line does.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 13:02:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653583#M731205</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2019-12-03T13:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a monthly qvd based on date field in data?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653585#M731206</link>
      <description>&lt;P&gt;I only have this 4 months of data. i dont have 2018 or 2020 data. haha. but thanks! Great Help from there!i will mark your suggestion as the solution, instead of mine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; .&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Rgds&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 13:05:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-monthly-qvd-based-on-date-field-in-data/m-p/1653585#M731206</guid>
      <dc:creator>jim_chan</dc:creator>
      <dc:date>2019-12-03T13:05:23Z</dc:date>
    </item>
  </channel>
</rss>

