<?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 write script to count the last 30 days for each date and load into temp table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1969041#M79936</link>
    <description>&lt;P&gt;Thank you but I have large data so&amp;nbsp; it took 14 hrs to load the data and finally it failed.&amp;nbsp; It dint work for me.&lt;/P&gt;
&lt;P&gt;I have one year data were each day the service id's will be created with the range of 4k-5k .&amp;nbsp; so for each day I have to calculate the&amp;nbsp; count of last 30 days service id's and insert the count to each date .&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2022 09:48:30 GMT</pubDate>
    <dc:creator>QlikSenseLearner</dc:creator>
    <dc:date>2022-08-16T09:48:30Z</dc:date>
    <item>
      <title>How to write script to count the last 30 days for each date and load into temp table</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1968168#M79816</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="topic-subject-wrapper"&gt;
&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;
&lt;DIV class="MessageSubject"&gt;
&lt;DIV class="lia-message-subject"&gt;I am developing app to show the count of service id's for last 30days for the each dates loaded. Please help to identify where I am going wrong.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="MessageInResponseTo lia-component-message-view-widget-in-response-to lia-component-in-response-to"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="bodyDisplay" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;&amp;nbsp;I am getting the same count for all the dates. But it should be different count for each date&amp;nbsp;, it should&lt;SPAN&gt;&amp;nbsp;represent the count of serviceid's&amp;nbsp; for past 30 days prior to each of the dates loaded through Variable. example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE width="224"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="160"&gt;date&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;30day volume&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/8/2022&lt;/TD&gt;
&lt;TD&gt;11970&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/7/2022&lt;/TD&gt;
&lt;TD&gt;12300&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/6/2022&lt;/TD&gt;
&lt;TD&gt;12890&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/5/2022&lt;/TD&gt;
&lt;TD&gt;11200&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;8/4/2022&lt;/TD&gt;
&lt;TD&gt;12100&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me to find the solution. I am using the below script:&lt;/P&gt;
&lt;P&gt;Let vMinDate = num(Date#('11/01/2021','MM/DD/YYYY')) ;&lt;BR /&gt;let vMaxDate= num(Date#(today(),'MM/DD/YYYY'));&lt;/P&gt;
&lt;P&gt;For X=$(vMinDate) to $(vMaxDate)&lt;/P&gt;
&lt;P&gt;Let Y= $(X)-30;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;FinalCount:&lt;BR /&gt;Load Sum(ServiceIdCount) as 'TotalCount'&lt;BR /&gt;Resident XYZ&lt;BR /&gt;where Floor(Date)&amp;gt;=$(Y) and&lt;BR /&gt;Floor(Date) &amp;lt; $(X)&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;Let i = peek('TotalCount', 0 ,'FinalCount');&lt;/P&gt;
&lt;P&gt;Temp:&lt;BR /&gt;Load&lt;BR /&gt;'$(X)' as 'Dte', '$(i)' as 'Cnt';&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;drop Table FinalCount;&lt;/P&gt;
&lt;P&gt;Next X&lt;/P&gt;
&lt;P&gt;drop table XYZ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting below result:&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="QlikSenseLearner_0-1660302816308.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86617iEB5186B7BFB7F52D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="QlikSenseLearner_0-1660302816308.png" alt="QlikSenseLearner_0-1660302816308.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Aug 2022 11:17:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1968168#M79816</guid>
      <dc:creator>QlikSenseLearner</dc:creator>
      <dc:date>2022-08-12T11:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to write script to count the last 30 days for each date and load into temp table</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1968302#M79852</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tryed with this little example (last 2 days). I'm using intervalmatch for generating all 2 days interval and after than I sum the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data:&lt;BR /&gt;Load&lt;BR /&gt;Date*1 as Date,&lt;BR /&gt;val&lt;BR /&gt;Inline [&lt;BR /&gt;Date, val&lt;BR /&gt;05/01/2022, 5&lt;BR /&gt;05/02/2022, 10&lt;BR /&gt;05/03/2022, 15&lt;BR /&gt;05/05/2022, 20&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;Left Join(Data)&lt;BR /&gt;IntervalMatch(Date)&lt;BR /&gt;Load&lt;BR /&gt;Date&lt;STRONG&gt; - 1&lt;/STRONG&gt; as Deb, //number of last days&lt;BR /&gt;Date*1 as DateFin&lt;BR /&gt;Resident Data&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;Load&lt;BR /&gt;DateFin,&lt;BR /&gt;Sum(val) as total&lt;BR /&gt;Resident Data&lt;BR /&gt;Group By&lt;BR /&gt;DateFin&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;Drop Table Data;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="amartinez35_0-1660314364189.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/86641i7A8D4BBEF26EA51F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="amartinez35_0-1660314364189.png" alt="amartinez35_0-1660314364189.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Aurélien&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 14:28:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1968302#M79852</guid>
      <dc:creator>Aurelien_Martinez</dc:creator>
      <dc:date>2022-08-12T14:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to write script to count the last 30 days for each date and load into temp table</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1969041#M79936</link>
      <description>&lt;P&gt;Thank you but I have large data so&amp;nbsp; it took 14 hrs to load the data and finally it failed.&amp;nbsp; It dint work for me.&lt;/P&gt;
&lt;P&gt;I have one year data were each day the service id's will be created with the range of 4k-5k .&amp;nbsp; so for each day I have to calculate the&amp;nbsp; count of last 30 days service id's and insert the count to each date .&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 09:48:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-write-script-to-count-the-last-30-days-for-each-date-and/m-p/1969041#M79936</guid>
      <dc:creator>QlikSenseLearner</dc:creator>
      <dc:date>2022-08-16T09:48:30Z</dc:date>
    </item>
  </channel>
</rss>

