<?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. :Re: Re. :Counting sales over period in load script. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232301#M83940</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you can do this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;tmpSales:&lt;BR /&gt;LOAD date#(Date,'DD.MM.YYYY') as Date,&lt;BR /&gt; Product,&lt;BR /&gt; Sales&lt;BR /&gt;INLINE [&lt;BR /&gt; Date, Product, Sales&lt;BR /&gt; 01.04.2010, Prod1, "297,77"&lt;BR /&gt; 01.04.2010, Prod2, "889,36"&lt;BR /&gt; 01.04.2010, Prod3, "313,52"&lt;BR /&gt; 02.04.2010, Prod1, "126,18"&lt;BR /&gt; 02.04.2010, Prod2, "656,22"&lt;BR /&gt; 02.04.2010, Prod3, "624,99"&lt;BR /&gt; 03.04.2010, Prod1, "823,88"&lt;BR /&gt; 03.04.2010, Prod2, "392,52"&lt;BR /&gt; 03.04.2010, Prod3, "561,32"&lt;BR /&gt; 04.04.2010, Prod1, "265,35"&lt;BR /&gt; 04.04.2010, Prod2, "924,12"&lt;BR /&gt; 04.04.2010, Prod3, "990,04"&lt;BR /&gt; 05.04.2010, Prod1, "254,63"&lt;BR /&gt; 05.04.2010, Prod2, "106,09"&lt;BR /&gt; 05.04.2010, Prod3, "843,05"&lt;BR /&gt; 06.04.2010, Prod1, "657,90"&lt;BR /&gt; 06.04.2010, Prod2, "309,20"&lt;BR /&gt; 06.04.2010, Prod3, "524,59"&lt;BR /&gt; 07.04.2010, Prod1, "549,02"&lt;BR /&gt; 07.04.2010, Prod2, "866,21"&lt;BR /&gt; 07.04.2010, Prod3, "738,24"&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Products:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Product, Period&lt;BR /&gt; Prod1, 3&lt;BR /&gt; Prod2, 4&lt;BR /&gt; Prod3, 5&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Sales:&lt;BR /&gt;LOAD Product,&lt;BR /&gt; Date,&lt;BR /&gt; Sales,&lt;BR /&gt; if(Product=peek('Product'),peek('SalesOverPeriod')+Sales,Sales) as SalesOverPeriod;&lt;BR /&gt;LOAD *,&lt;BR /&gt; 0 as SalesOverPeriod&lt;BR /&gt;RESIDENT tmpSales&lt;BR /&gt;ORDER BY Product, Date;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE tmpSales;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 May 2010 12:40:37 GMT</pubDate>
    <dc:creator>martin59</dc:creator>
    <dc:date>2010-05-05T12:40:37Z</dc:date>
    <item>
      <title>Counting sales over period in load script.</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232298#M83937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi to everyone.&lt;BR /&gt;I have two tables:&lt;BR /&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;Sales:LOAD date(Date) as Date, Product, Sales INLINE [ Date, Product, Sales 01.04.2010, Prod1, "297,77" 01.04.2010, Prod2, "889,36" 01.04.2010, Prod3, "313,52" 02.04.2010, Prod1, "126,18" 02.04.2010, Prod2, "656,22" 02.04.2010, Prod3, "624,99" 03.04.2010, Prod1, "823,88" 03.04.2010, Prod2, "392,52" 03.04.2010, Prod3, "561,32" 04.04.2010, Prod1, "265,35" 04.04.2010, Prod2, "924,12" 04.04.2010, Prod3, "990,04" 05.04.2010, Prod1, "254,63" 05.04.2010, Prod2, "106,09" 05.04.2010, Prod3, "843,05" 06.04.2010, Prod1, "657,90" 06.04.2010, Prod2, "309,20" 06.04.2010, Prod3, "524,59" 07.04.2010, Prod1, "549,02" 07.04.2010, Prod2, "866,21" 07.04.2010, Prod3, "738,24"];Products:LOAD * INLINE [ Product, Period Prod1, 3 Prod2, 4 Prod3, 5];&lt;/PRE&gt;&lt;BR /&gt;I need to get in load script a table that will have a counted sum of sales for this product over the period that is defined for ecery product.&lt;BR /&gt;For example - I'll have in a row:&lt;BR /&gt;Date=01.04.2010; Product=Prod1; SalesOverPeriod=297,77 that is: 0+0+297,77&lt;BR /&gt;Date=06.04.2010; Product=Prod2; SalesOverPeriod=1731,93 that is: 392,52+924,12+106,09+309,20&lt;BR /&gt;&lt;BR /&gt;Full table must look like:&lt;BR /&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;SalesOverPeriiod:LOAD * INLINE [ Date, Product, SalesOverPeriod 01.04.2010, Prod1, "297,77" 01.04.2010, Prod2, "889,36" 01.04.2010, Prod3, "313,52" 02.04.2010, Prod1, "423,95" 02.04.2010, Prod2, "1545,58" 02.04.2010, Prod3, "938,51" 03.04.2010, Prod1, "1247,83" 03.04.2010, Prod2, "1938,10" 03.04.2010, Prod3, "1499,83" 04.04.2010, Prod1, "1215,41" 04.04.2010, Prod2, "2862,22" 04.04.2010, Prod3, "2489,87" 05.04.2010, Prod1, "1343,86" 05.04.2010, Prod2, "2078,95" 05.04.2010, Prod3, "3332,92" 06.04.2010, Prod1, "1177,88" 06.04.2010, Prod2, "1731,93" 06.04.2010, Prod3, "3543,99" 07.04.2010, Prod1, "1461,55" 07.04.2010, Prod2, "2205,62" 07.04.2010, Prod3, "3657,24"];&lt;/PRE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 11:59:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232298#M83937</guid>
      <dc:creator />
      <dc:date>2010-05-05T11:59:16Z</dc:date>
    </item>
    <item>
      <title>Re. :Counting sales over period in load script.</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232299#M83938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Why don't you accumulate your values in a graphic object ?&lt;/P&gt;&lt;P&gt;You can enter this expression :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sum(sales)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;check this option :&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/1731.QlikCommunity.PNG"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/1731.QlikCommunity.PNG" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;With Products and Date as dimensions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 12:15:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232299#M83938</guid>
      <dc:creator>martin59</dc:creator>
      <dc:date>2010-05-05T12:15:53Z</dc:date>
    </item>
    <item>
      <title>Re. :Counting sales over period in load script.</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232300#M83939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because I need to work with this table doing some more calculations, and because in my real table there are more than 300 dates, something like 2k products and every product has a different period for counting - starting from 7 to 120. And one more - for every date and product I need to have their uniqe SalesOverPeriod sum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 12:21:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232300#M83939</guid>
      <dc:creator />
      <dc:date>2010-05-05T12:21:14Z</dc:date>
    </item>
    <item>
      <title>Re. :Re: Re. :Counting sales over period in load script.</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232301#M83940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you can do this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;tmpSales:&lt;BR /&gt;LOAD date#(Date,'DD.MM.YYYY') as Date,&lt;BR /&gt; Product,&lt;BR /&gt; Sales&lt;BR /&gt;INLINE [&lt;BR /&gt; Date, Product, Sales&lt;BR /&gt; 01.04.2010, Prod1, "297,77"&lt;BR /&gt; 01.04.2010, Prod2, "889,36"&lt;BR /&gt; 01.04.2010, Prod3, "313,52"&lt;BR /&gt; 02.04.2010, Prod1, "126,18"&lt;BR /&gt; 02.04.2010, Prod2, "656,22"&lt;BR /&gt; 02.04.2010, Prod3, "624,99"&lt;BR /&gt; 03.04.2010, Prod1, "823,88"&lt;BR /&gt; 03.04.2010, Prod2, "392,52"&lt;BR /&gt; 03.04.2010, Prod3, "561,32"&lt;BR /&gt; 04.04.2010, Prod1, "265,35"&lt;BR /&gt; 04.04.2010, Prod2, "924,12"&lt;BR /&gt; 04.04.2010, Prod3, "990,04"&lt;BR /&gt; 05.04.2010, Prod1, "254,63"&lt;BR /&gt; 05.04.2010, Prod2, "106,09"&lt;BR /&gt; 05.04.2010, Prod3, "843,05"&lt;BR /&gt; 06.04.2010, Prod1, "657,90"&lt;BR /&gt; 06.04.2010, Prod2, "309,20"&lt;BR /&gt; 06.04.2010, Prod3, "524,59"&lt;BR /&gt; 07.04.2010, Prod1, "549,02"&lt;BR /&gt; 07.04.2010, Prod2, "866,21"&lt;BR /&gt; 07.04.2010, Prod3, "738,24"&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Products:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Product, Period&lt;BR /&gt; Prod1, 3&lt;BR /&gt; Prod2, 4&lt;BR /&gt; Prod3, 5&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Sales:&lt;BR /&gt;LOAD Product,&lt;BR /&gt; Date,&lt;BR /&gt; Sales,&lt;BR /&gt; if(Product=peek('Product'),peek('SalesOverPeriod')+Sales,Sales) as SalesOverPeriod;&lt;BR /&gt;LOAD *,&lt;BR /&gt; 0 as SalesOverPeriod&lt;BR /&gt;RESIDENT tmpSales&lt;BR /&gt;ORDER BY Product, Date;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE tmpSales;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 12:40:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232301#M83940</guid>
      <dc:creator>martin59</dc:creator>
      <dc:date>2010-05-05T12:40:37Z</dc:date>
    </item>
    <item>
      <title>Re. :Re: Re. :Counting sales over period in load script.</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232302#M83941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Umh thanks but... In this table you make a full accumulation, and I don't need full accumulation, I need an accumulation over the defined period - as in table "Products" - for Prod1 - 3 last days, for Prod2 - 4 last days, for Prod3 - 5 last days etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 12:57:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232302#M83941</guid>
      <dc:creator />
      <dc:date>2010-05-05T12:57:06Z</dc:date>
    </item>
    <item>
      <title>Re. :Re: Re. :Counting sales over period in load script.</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232303#M83942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using your idea got the right script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;tmpSales:LOAD date#(Date,'DD.MM.YYYY') as Date, Product, SalesINLINE [ Date, Product, Sales 01.04.2010, Prod1, "297,77" 01.04.2010, Prod2, "889,36" 01.04.2010, Prod3, "313,52" 02.04.2010, Prod1, "126,18" 02.04.2010, Prod2, "656,22" 02.04.2010, Prod3, "624,99" 03.04.2010, Prod1, "823,88" 03.04.2010, Prod2, "392,52" 03.04.2010, Prod3, "561,32" 04.04.2010, Prod1, "265,35" 04.04.2010, Prod2, "924,12" 04.04.2010, Prod3, "990,04" 05.04.2010, Prod1, "254,63" 05.04.2010, Prod2, "106,09" 05.04.2010, Prod3, "843,05" 06.04.2010, Prod1, "657,90" 06.04.2010, Prod2, "309,20" 06.04.2010, Prod3, "524,59" 07.04.2010, Prod1, "549,02" 07.04.2010, Prod2, "866,21" 07.04.2010, Prod3, "738,24"];Products:LOAD * INLINE [ Product, Period Prod1, 3 Prod2, 4 Prod3, 5];Left join (tmpSales) load * resident Products;Sales:LOAD Product, Date, Sales, if(Product=peek('Product'),peek('SalesOverPeriod')+Sales-if(Product=peek('Product',-Period),peek('Sales',-Period),0),Sales) as SalesOverPeriod;LOAD *, 0 as SalesOverPeriodRESIDENT tmpSalesORDER BY Product, Date;DROP TABLE tmpSales;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;thnx, Martin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 13:38:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-sales-over-period-in-load-script/m-p/232303#M83942</guid>
      <dc:creator />
      <dc:date>2010-05-05T13:38:46Z</dc:date>
    </item>
  </channel>
</rss>

