<?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 Period by Day in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228878#M80860</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have modify my function like this but it's works for the 10 fist days, but after the 10/09/2009 any date is return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sub getHistoInfoByDay(path, prefix, dateField,nbDaysBefore)&lt;BR /&gt;&lt;BR /&gt; // Sets the default first date of the history&lt;BR /&gt; let minDate=num(date('$(startHistoryDate)'));&lt;BR /&gt;&lt;BR /&gt; trace 'getHistoInfo minDate ' &amp;amp; $(minDate);&lt;BR /&gt;&lt;BR /&gt; // Gets the last date gathered into qvds&lt;BR /&gt; CALL GetLastDate(path, prefix, '$(dateField)', lastDate);&lt;BR /&gt; trace 'GetLastDate lastDate ' &amp;amp; $(lastDate);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; // The last date become the newest minDate&lt;BR /&gt; unless isnull(lastDate) let minDate=num(date('$(lastDate)'))+1; // minDate=lastDate+1&lt;BR /&gt;&lt;BR /&gt; // Historic date management.(evol : 23/03/2010)&lt;BR /&gt;&lt;BR /&gt; if (isnull(lastDate)=-1 ) then&lt;BR /&gt; let lastDate='$(startHistoryDate)';&lt;BR /&gt; trace 'lastDate' &amp;amp; $(lastDate);&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; if ( (num(lastDate)=minDate) or (minDate=num(date('$(startHistoryDate)'))) ) then&lt;BR /&gt; let x=0;&lt;BR /&gt; let RefDate=lastDate;&lt;BR /&gt; else&lt;BR /&gt; if(nbDaysBefore&amp;gt;0) then&lt;BR /&gt; let x=nbDaysBefore;&lt;BR /&gt;&lt;BR /&gt; let RefDate=num(lastDate) - x;&lt;BR /&gt; let minDate=num(date(minDate -x,'DD/MM/YYYY'));&lt;BR /&gt; end if&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt;trace 'RefDate' &amp;amp; $(RefDate);&lt;BR /&gt;&lt;BR /&gt; // Set the last date to today&lt;BR /&gt; let maxDate=num(date(today(2)));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; // Calculate the # of days between min and max dates&lt;BR /&gt; let nbiter=maxDate-minDate;&lt;BR /&gt;&lt;BR /&gt; // Drop histoPieces if already exists as resident&lt;BR /&gt; unless isnull(NoOfRows('_histoPieces')) DROP TABLE _histoPieces;&lt;BR /&gt;&lt;BR /&gt; // Generates a table containing all the daily periods between min and max date&lt;BR /&gt; _histoPieces:&lt;BR /&gt; load&lt;BR /&gt; if(recno()=1, date($(minDate)), date($(minDate)+recno())) as monthstart,&lt;BR /&gt; ($(minDate)) as monthend&lt;BR /&gt; autogenerate ($(nbiter));&lt;BR /&gt;end sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You have a idea why please ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Apr 2010 13:40:28 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-04-30T13:40:28Z</dc:date>
    <item>
      <title>Period by Day</title>
      <link>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228877#M80859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi every one,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to create a script which create QVD files since a Database table, but I must create a QVD by day in the Data base:&lt;/P&gt;&lt;P&gt;for this I have a function which work for create QVD by Month :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;sub getHistoInfo(path, prefix, dateField,nbDaysBefore)&lt;BR /&gt;&lt;BR /&gt; // Sets the default first date of the history&lt;BR /&gt; let minDate=num(date('$(startHistoryDate)'));&lt;BR /&gt;&lt;BR /&gt; trace 'getHistoInfo minDate ' &amp;amp; $(minDate);&lt;BR /&gt;&lt;BR /&gt; // Gets the last date gathered into qvds&lt;BR /&gt; CALL GetLastDate(path, prefix, '$(dateField)', lastDate);&lt;BR /&gt; trace 'GetLastDate lastDate ' &amp;amp; $(lastDate);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; // The last date become the newest minDate&lt;BR /&gt; unless isnull(lastDate) let minDate=num(date('$(lastDate)'))+1; // minDate=lastDate+1&lt;BR /&gt;&lt;BR /&gt; // Historic date management.(evol : 23/03/2010)&lt;BR /&gt;&lt;BR /&gt; if (isnull(lastDate)=-1 ) then&lt;BR /&gt; let lastDate='$(startHistoryDate)';&lt;BR /&gt; trace 'lastDate' &amp;amp; $(lastDate);&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; if ( (num(lastDate)=minDate) or (minDate=num(date('$(startHistoryDate)'))) ) then&lt;BR /&gt; let x=0;&lt;BR /&gt; let RefDate=lastDate;&lt;BR /&gt; else&lt;BR /&gt; if(nbDaysBefore&amp;gt;0) then&lt;BR /&gt; let x=nbDaysBefore;&lt;BR /&gt;&lt;BR /&gt; let RefDate=num(lastDate) - x;&lt;BR /&gt; let minDate=num(monthstart(date(minDate -x,'DD/MM/YYYY')));&lt;BR /&gt; end if&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt;trace 'RefDate' &amp;amp; $(RefDate);&lt;BR /&gt;&lt;BR /&gt; // Set the last date to today&lt;BR /&gt; let maxDate=num(date(today(2)));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; // Calculate the # of days between min and max dates&lt;BR /&gt; let nbDays=maxDate-minDate;&lt;BR /&gt;&lt;BR /&gt; // Calculate the # of months between min and max dates&lt;BR /&gt; if year(maxDate)=year(minDate) then&lt;BR /&gt; let nbiter=month($(maxDate))-month($(minDate))+1;&lt;BR /&gt; else&lt;BR /&gt; let nbiter=month($(maxDate))+(12-month($(minDate))+1)+12*((year(maxDate)-1)-year(minDate));&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; // Drop histoPieces if already exists as resident&lt;BR /&gt; unless isnull(NoOfRows('_histoPieces')) DROP TABLE _histoPieces;&lt;BR /&gt;&lt;BR /&gt; // Generates a table containing all the monthly periods between min and max date&lt;BR /&gt; _histoPieces:&lt;BR /&gt; load&lt;BR /&gt; if(recno()=1, date($(minDate)), monthstart(addmonths($(minDate), recno()-1))) as monthstart,&lt;BR /&gt; monthend(addmonths($(minDate), recno()-1)) as monthend,&lt;BR /&gt; autogenerate ($(nbiter));&lt;BR /&gt;end sub&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;And in the script :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call getHistoInfo('$(pathQVD)MVT', 'MVT_$(DBName)', 'date',0);&lt;BR /&gt;// only for test&lt;BR /&gt;//___________________&lt;BR /&gt;//set nbiter=3;&lt;BR /&gt;//___________________&lt;BR /&gt;&lt;BR /&gt;for i=0 to $(nbiter)-1&lt;BR /&gt;&lt;BR /&gt; let startdate=peek('monthstart',i,'_histoPieces');&lt;BR /&gt; let enddate=date(num(peek('monthend',i))+1);&lt;BR /&gt; let monthdate=num(month(peek('monthstart',i,'_histoPieces')),'00');&lt;BR /&gt; let daydate=num(day(peek('monthstart',i,'_histoPieces')),'00');&lt;BR /&gt; let yeardate=year(peek('monthstart',i,'_histoPieces'));&lt;BR /&gt;&lt;BR /&gt; let strTrace='*** Current period : &amp;gt;=' &amp;amp; '$(startdate)' &amp;amp; ' and &amp;lt;' &amp;amp; '$(enddate)';&lt;BR /&gt; trace $(strTrace);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And afetr a Store the table selected in the QVD with the name of the periode.&lt;/P&gt;&lt;P&gt;It work perfectly for period by month but I don't understand how I can modifie this function to selected for each day a QVD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Apr 2010 08:58:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228877#M80859</guid>
      <dc:creator />
      <dc:date>2010-04-30T08:58:51Z</dc:date>
    </item>
    <item>
      <title>Period by Day</title>
      <link>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228878#M80860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have modify my function like this but it's works for the 10 fist days, but after the 10/09/2009 any date is return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sub getHistoInfoByDay(path, prefix, dateField,nbDaysBefore)&lt;BR /&gt;&lt;BR /&gt; // Sets the default first date of the history&lt;BR /&gt; let minDate=num(date('$(startHistoryDate)'));&lt;BR /&gt;&lt;BR /&gt; trace 'getHistoInfo minDate ' &amp;amp; $(minDate);&lt;BR /&gt;&lt;BR /&gt; // Gets the last date gathered into qvds&lt;BR /&gt; CALL GetLastDate(path, prefix, '$(dateField)', lastDate);&lt;BR /&gt; trace 'GetLastDate lastDate ' &amp;amp; $(lastDate);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; // The last date become the newest minDate&lt;BR /&gt; unless isnull(lastDate) let minDate=num(date('$(lastDate)'))+1; // minDate=lastDate+1&lt;BR /&gt;&lt;BR /&gt; // Historic date management.(evol : 23/03/2010)&lt;BR /&gt;&lt;BR /&gt; if (isnull(lastDate)=-1 ) then&lt;BR /&gt; let lastDate='$(startHistoryDate)';&lt;BR /&gt; trace 'lastDate' &amp;amp; $(lastDate);&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt; if ( (num(lastDate)=minDate) or (minDate=num(date('$(startHistoryDate)'))) ) then&lt;BR /&gt; let x=0;&lt;BR /&gt; let RefDate=lastDate;&lt;BR /&gt; else&lt;BR /&gt; if(nbDaysBefore&amp;gt;0) then&lt;BR /&gt; let x=nbDaysBefore;&lt;BR /&gt;&lt;BR /&gt; let RefDate=num(lastDate) - x;&lt;BR /&gt; let minDate=num(date(minDate -x,'DD/MM/YYYY'));&lt;BR /&gt; end if&lt;BR /&gt; endif&lt;BR /&gt;&lt;BR /&gt;trace 'RefDate' &amp;amp; $(RefDate);&lt;BR /&gt;&lt;BR /&gt; // Set the last date to today&lt;BR /&gt; let maxDate=num(date(today(2)));&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; // Calculate the # of days between min and max dates&lt;BR /&gt; let nbiter=maxDate-minDate;&lt;BR /&gt;&lt;BR /&gt; // Drop histoPieces if already exists as resident&lt;BR /&gt; unless isnull(NoOfRows('_histoPieces')) DROP TABLE _histoPieces;&lt;BR /&gt;&lt;BR /&gt; // Generates a table containing all the daily periods between min and max date&lt;BR /&gt; _histoPieces:&lt;BR /&gt; load&lt;BR /&gt; if(recno()=1, date($(minDate)), date($(minDate)+recno())) as monthstart,&lt;BR /&gt; ($(minDate)) as monthend&lt;BR /&gt; autogenerate ($(nbiter));&lt;BR /&gt;end sub&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You have a idea why please ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Apr 2010 13:40:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228878#M80860</guid>
      <dc:creator />
      <dc:date>2010-04-30T13:40:28Z</dc:date>
    </item>
    <item>
      <title>Period by Day</title>
      <link>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228879#M80861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My new version of the code :&lt;/P&gt;&lt;P&gt;With Month-CHrun a column calculded with ID&lt;/P&gt;&lt;P&gt;((sum({ $&amp;lt;[Date]={"&amp;gt;=$(=monthstart([Month-Churn])) &amp;lt;=$([Month-Churn])"}, Month= ,Year=,Week= &amp;gt;} [USER.Nb user ID]))&lt;BR /&gt;-(sum( { $&amp;lt;[Date]={"&amp;gt;=$(=monthstart(max([Date])))&amp;lt;=$(=max([Date]))"}&amp;gt;}[USER.Nb user ID]))&lt;BR /&gt;+(sum( { $&amp;lt;USER.Cohorte={"&amp;gt;=$(=monthstart(max([Date])))&amp;lt;=$(=max([Date]))"}&amp;gt;} [USER.Nb user ID])))&lt;BR /&gt;/&lt;BR /&gt;(sum({ $&amp;lt;[Date]={"&amp;gt;=$(=monthstart([Month-Churn])) &amp;lt;=$([Month-Churn])"}, Month= ,Year=,Week= &amp;gt;} [USER.Nb user ID]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a NULL value I don't know why can you help me please?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 14:14:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Period-by-Day/m-p/228879#M80861</guid>
      <dc:creator />
      <dc:date>2010-05-03T14:14:08Z</dc:date>
    </item>
  </channel>
</rss>

