<?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: Selective Aggr in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54126#M9015</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, if the dates are not sorted from the script... you have two options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) If you have qv12 or above... you can use this&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4673"&gt;The sortable Aggr function is finally here!&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Concat(Aggr(If(QtyReturn &amp;gt;= RangeSum(Above(Sum(QtyBought), 0, RowNo())), PO_Num), ProductCode, &lt;SPAN style="color: #ff0000;"&gt;(&lt;/SPAN&gt;PO_Date&lt;SPAN style="color: #ff0000;"&gt;, (NUMERIC))&lt;/SPAN&gt;), ', ', -PO_Date)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Sort PO_Date in the script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Jun 2018 18:59:56 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-06-04T18:59:56Z</dc:date>
    <item>
      <title>Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54120#M9009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 tables; one containing all my products, and one containing all the purchaseorders, when products are bought.&lt;/P&gt;&lt;P&gt;In the product table I have a return quantity, representing the quantity I want to return. My goal is for each product to return, to get the list of PO I must reference to cover the quantity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To better show what I try to do let`s take this sample data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product:&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;ProductCode, QtyReturn&lt;/P&gt;&lt;P&gt;1 , 500&lt;/P&gt;&lt;P&gt;2 , 900&lt;/P&gt;&lt;P&gt;3 , 200&lt;/P&gt;&lt;P&gt;4 , 300&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PurchaseOrder:&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;PO_Num, ProductCode, QtyBought, PO_Date&lt;/P&gt;&lt;P&gt;2234, 1 , 200, 2018-06-03&lt;/P&gt;&lt;P&gt;2235, 2 , 300,&amp;nbsp; 2018-06-02&lt;/P&gt;&lt;P&gt;2234, 3 , 100,&amp;nbsp; 2018-06-03&lt;/P&gt;&lt;P&gt;2234 ,4 , 500,&amp;nbsp; 2018-06-03&lt;/P&gt;&lt;P&gt;3214 , 1 , 100, 2018-06-02&lt;/P&gt;&lt;P&gt;4564 , 1 , 200, 2018-05-22&lt;/P&gt;&lt;P&gt;3245, 2 , 2500, 2018-05-22&lt;/P&gt;&lt;P&gt;5645, 3, 200, 2018-05-22&lt;/P&gt;&lt;P&gt;4344, 1 , 200, 2018-04-03&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this formula I am able to get a list of all PO for each product and all quantities&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=aggr(concat(PO_Num,', ', -PO_Date ),ProductCode)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which for product 1 is : 2234, 3214, 4564, 4344&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;=aggr(concat(QtyBought,', ', -PO_Date ),ProductCode)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;200, 100, 200, 200&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="204298" alt="qv1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/204298_qv1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I really want is to get only the PurchaseOrder numbers until I reach the amount to return. &lt;SPAN style="font-size: 13.3333px;"&gt;QtyReturn = &lt;/SPAN&gt;500 for product 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, for product 1, it would be : &lt;SPAN style="font-size: 13.3333px;"&gt;2234, 3214, 4564 instead of &lt;SPAN style="font-size: 13.3333px;"&gt;2234, 3214, 4564, 4344.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I tried many combination of Aggr, Sum, Rank ... But can`t seem to put my finger on the solution ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the last thing I tried, which give me just 2234 ... not even close.&lt;/P&gt;&lt;P&gt;= concat( IF( aggr ( rank( sum(QtyBought )),ProductCode)&amp;lt;=QtyReturn, PO_Num)&amp;nbsp; , ';', -PO_Date )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help, hope I was able to explain clairly what I am trying to achieve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:09:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54120#M9009</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-04T18:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54121#M9010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll have to sort the aggr. That's complicated but, have a look at this blog post: &lt;A href="https://community.qlik.com/qlik-blogpost/5065"&gt;Recipe for a Pareto Analysis – Revisited&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:13:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54121#M9010</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2018-06-04T18:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54122#M9011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Concat(Aggr(If(QtyReturn &amp;gt;= RangeSum(Above(Sum(QtyBought), 0, RowNo())), PO_Num), ProductCode, PO_Date), ', ', -PO_Date)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/204299_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:14:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54122#M9011</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-06-04T18:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54123#M9012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will go read the blog post to learn more ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:16:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54123#M9012</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-04T18:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54124#M9013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works ... thanks ... Will check it until I fully understand it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:16:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54124#M9013</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-04T18:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54125#M9014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By checking more, it does not check for the dates correctly. Trying to get the most recent dates first. But if they are not already sorted, that does not seem to work. That is why I had the&amp;nbsp; minus sign in front of PO_Date. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:56:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54125#M9014</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-04T18:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54126#M9015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, if the dates are not sorted from the script... you have two options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) If you have qv12 or above... you can use this&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4673"&gt;The sortable Aggr function is finally here!&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Concat(Aggr(If(QtyReturn &amp;gt;= RangeSum(Above(Sum(QtyBought), 0, RowNo())), PO_Num), ProductCode, &lt;SPAN style="color: #ff0000;"&gt;(&lt;/SPAN&gt;PO_Date&lt;SPAN style="color: #ff0000;"&gt;, (NUMERIC))&lt;/SPAN&gt;), ', ', -PO_Date)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Sort PO_Date in the script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 18:59:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54126#M9015</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-06-04T18:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Aggr</title>
      <link>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54127#M9016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am still at version 11 .. Will use option 2 ... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2018 19:03:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Selective-Aggr/m-p/54127#M9016</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-04T19:03:25Z</dc:date>
    </item>
  </channel>
</rss>

