<?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: Optimizing dynamic aggr() function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562140#M209795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can probably optimize things by creating an AsOf table to easily calculate the rolling 13 weeks amounts with good performance. Also create a numeric YearWeek field so you can use max instead of maxstring. Perhaps you can also replace the if statements with set modifiers. Can you post an example document? Read this document for how to create a non-confidential example: &lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-1290" style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3778c7;"&gt;Preparing examples for Upload - Reduction and Data Scrambling&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Oct 2013 16:38:18 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-10-15T16:38:18Z</dc:date>
    <item>
      <title>Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562139#M209794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear QlikView fanatics,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggeling for quite some time now to create a dynamic LFL data set based on store opening and closing.&lt;/P&gt;&lt;P&gt;With some help i came up with this Aggr() statement for Turnover (index) LFL rolling 13 weeks vs previous LFL rolling 13 weeks.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum&lt;/SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;OpenYearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MaxString&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PeriodID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=Max(PeriodID)-25)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;},&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Week&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;YearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;nbsp; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClosedYearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MaxString&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;YearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PeriodID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt;=$(=Max(PeriodID)-12)&amp;lt;=$(=Max(PeriodID))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;},&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = ,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;#NetValue_EUR&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),0), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;StoreName&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Country&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;OpenYearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MaxString&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PeriodID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;lt;=$(=Max(PeriodID)-25)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;},&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Week&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;YearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;ClosedYearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MaxString&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;YearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;PeriodID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt;=$(=Max(PeriodID)-25)&amp;lt;=$(=Max(PeriodID)-13)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;},&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = ,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YearWeek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;#NetValue_EUR&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),0), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;StoreName&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Country&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the same aggr function for conversionrate/grossmargin/visitors and so on. This calculation works properly although the performance is real shit.:(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could also flag stores in script for LFL store last13weeks. But i would like to keep the function that users can select a different week than the current.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone point me in the right direction here? Any help is much appriciated!&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 15:44:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562139#M209794</guid>
      <dc:creator />
      <dc:date>2013-10-15T15:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562140#M209795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can probably optimize things by creating an AsOf table to easily calculate the rolling 13 weeks amounts with good performance. Also create a numeric YearWeek field so you can use max instead of maxstring. Perhaps you can also replace the if statements with set modifiers. Can you post an example document? Read this document for how to create a non-confidential example: &lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-1290" style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3778c7;"&gt;Preparing examples for Upload - Reduction and Data Scrambling&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 16:38:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562140#M209795</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-10-15T16:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562141#M209796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, Thanks allot!&lt;/P&gt;&lt;P&gt;I think you helped me allot allready by pointing me in the right direction. I will try your advice and i'm very glad you are willing to helping me even further by analyzing my qvw. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't want to ask more instead of trying more myself. So i will first try to optimize the qvw/calculations myself. I will let you know how this works out!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2013 07:53:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562141#M209796</guid>
      <dc:creator />
      <dc:date>2013-10-16T07:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562142#M209797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am almost there, allthough i have 1 small and weird problem. For some reason i can't convert the store atribute OpenYearWeekCode to a number by using: Num(OpenYearWeekCode)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will result in - value's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This field contains value's like: 2013W23. I've replaced the W with "/" to create the same format as YearWeek&amp;nbsp; in my Master Calander.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the num(Peek) function on my calander to create the current yearweek or -52 etc. To create my initial calculation i will have to have the OpenYearWeekCode converted to the same number format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea's ? this should be quite simple right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 08:23:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562142#M209797</guid>
      <dc:creator />
      <dc:date>2013-10-17T08:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562143#M209798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;num#(replace(OpenYearWeekCode,'W','')) should create a numeric value like 201323. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 09:22:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562143#M209798</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-10-17T09:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562144#M209799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes i can create that format. But the value retrieved by the num(Peek)) function is like 41547 translated from 2013/40?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 10:57:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562144#M209799</guid>
      <dc:creator />
      <dc:date>2013-10-17T10:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562145#M209800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That looks like it's the numeric value of a date. =num(MakeWeekDate(2013,40)) returns 41547 in a text box. Perhaps you want to use this: dual(replace(OpenYearWeekCode,'W','/'), makeweekdate(left(OpenYearWeekCode,4),right(OpenYearWeekCode,2))) as OpenYearWeekCode. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 11:29:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562145#M209800</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-10-17T11:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing dynamic aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562146#M209801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats it ! perfect thanks allot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bedankt man;) mocht ik jouw nog ergens mee kunnen helpen hoor ik het graag!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 11:47:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimizing-dynamic-aggr-function/m-p/562146#M209801</guid>
      <dc:creator />
      <dc:date>2013-10-17T11:47:41Z</dc:date>
    </item>
  </channel>
</rss>

