<?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: Geting the previous Item Price using Bottom() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807478#M285109</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;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Do you think it would work better even with more tha 30 million rows? (Sorry I'm not very good at testing performance)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Mar 2015 14:58:18 GMT</pubDate>
    <dc:creator>mrooney</dc:creator>
    <dc:date>2015-03-27T14:58:18Z</dc:date>
    <item>
      <title>Geting the previous Item Price using Bottom()</title>
      <link>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807476#M285107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;Mi client asked me to have his inventory valued at any give date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My inventory movements table looks like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="499"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="91"&gt;Wharehouse &lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="75"&gt;ItemCode&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="67"&gt;Year&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="63"&gt;Month&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="61"&gt;Day&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="65"&gt;Qty&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="77"&gt;Avg. Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;W1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3233&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;W2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3233&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;30&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1.35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;W3&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3233&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;-10&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1.35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;W4&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3233&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1.32&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;W5&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3233&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;29&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;25&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1.51&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in case there is no movement at a particular date, I have to take the Avg. Price from de first previous movement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My approach:&lt;/P&gt;&lt;P&gt;1.- I haven't solved it in script because preformance issues could appear (lots of warehouses, Items and too much gaps beetwen movement dates).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.- I'm using (and it's working fine) this expression (Simplified):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(Qty) * Bottom(Aggr(Sum(AvgPrice),Warehouse,ItemCode,Year,Month,Day))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question:&lt;/P&gt;&lt;P&gt;¿Do you think there is a better solution than this one in order to improve performance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 14:29:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807476#M285107</guid>
      <dc:creator>mrooney</dc:creator>
      <dc:date>2015-03-27T14:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Geting the previous Item Price using Bottom()</title>
      <link>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807477#M285108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd still fix it in the script. It's easier and will result in better performance of the front end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;LOAD * FROM ...source... ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;NOCONCATENATE LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wharehouse as Warehouse,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ItemCode,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qty,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alt([Avg. Price], if(previous(ItemCode)=ItemCode, peek('Avg. Price'))) as &lt;SPAN style="font-size: 13.3333330154419px;"&gt;[Avg. Price]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;RESIDENT Temp&lt;/P&gt;&lt;P&gt;ORDER BY ItemCode, Year, Month, Day;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 14:50:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807477#M285108</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-03-27T14:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Geting the previous Item Price using Bottom()</title>
      <link>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807478#M285109</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;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Do you think it would work better even with more tha 30 million rows? (Sorry I'm not very good at testing performance)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 14:58:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807478#M285109</guid>
      <dc:creator>mrooney</dc:creator>
      <dc:date>2015-03-27T14:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Geting the previous Item Price using Bottom()</title>
      <link>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807479#M285110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. Millions of rows will hurt performance much worse in the front end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 15:06:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Geting-the-previous-Item-Price-using-Bottom/m-p/807479#M285110</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-03-27T15:06:35Z</dc:date>
    </item>
  </channel>
</rss>

