<?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: Double AGGR Function in a Table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003224#M83067</link>
    <description>&lt;P&gt;Unfortunately, this didn't seem to work.&amp;nbsp; It was also missing one of the dimensions within one of the AGGR commands, but whether I put in Product ID or Feature 1, it didn't matter.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2022 17:39:00 GMT</pubDate>
    <dc:creator>spjuza</dc:creator>
    <dc:date>2022-11-10T17:39:00Z</dc:date>
    <item>
      <title>Double AGGR Function in a Table</title>
      <link>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003132#M83060</link>
      <description>&lt;P&gt;I have a table with a variety of costs and I'm needing to get the 50th Percentile Cost within a feature.&amp;nbsp; As I understand it, I will need to do two aggregations, one to get the total amount spent per product and then one to get the 50% cost within the feature.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample data table:&lt;/P&gt;
&lt;P&gt;Product ID|Feature 1|Quanity|Spend&lt;/P&gt;
&lt;P&gt;1|1|100|$1000&lt;/P&gt;
&lt;P&gt;1|1|100|$1500&lt;/P&gt;
&lt;P&gt;2|1|20|$220&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the results would look like this:&lt;/P&gt;
&lt;P&gt;Product ID|Feature 1|Quanity|Spend|Average Cost per Product ID|50th Percentile within Product ID|50th Percentile within Feature&lt;/P&gt;
&lt;P&gt;1|1|100|$1000|$10|$12.5|$11&lt;/P&gt;
&lt;P&gt;1|1|100|$1500|$15|$12.5|$11&lt;/P&gt;
&lt;P&gt;2|1|20|$220|$11|$11|$11&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;I have the code for how to get the Average cost per product, that was easy.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fractile(aggr(sum([Spend])/sum([Quantity]),[Product ID]),.50)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, trying to get that into a second aggregation has proved tricky.&amp;nbsp; Wrapping everything in an additional Aggr doesn't return the expected values.&lt;/P&gt;
&lt;P&gt;Fractile(aggr(aggr(sum([Spend])/sum([Qty]), [Product ID]),[Feature 1]),.50)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thoughts on how to proceed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT:&amp;nbsp; Someone at work pointed out that one of the issues is that you are overriding dimensions to show other data and suggested to use the Total function, but still not entirely sure how to go about that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 16:06:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003132#M83060</guid>
      <dc:creator>spjuza</dc:creator>
      <dc:date>2022-11-10T16:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Double AGGR Function in a Table</title>
      <link>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003207#M83065</link>
      <description>&lt;P&gt;Maybe this could work, You can add the brackets and fields based on your requirement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Fractile(Aggr(Sum(Total(aggr(sum([Spend])/sum([Qty]), [Product ID])),[Feature 1])),.50)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My suggestion would be to use variables rather than the direct equations.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 16:43:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003207#M83065</guid>
      <dc:creator>deepanshuSh</dc:creator>
      <dc:date>2022-11-10T16:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Double AGGR Function in a Table</title>
      <link>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003224#M83067</link>
      <description>&lt;P&gt;Unfortunately, this didn't seem to work.&amp;nbsp; It was also missing one of the dimensions within one of the AGGR commands, but whether I put in Product ID or Feature 1, it didn't matter.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 17:39:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003224#M83067</guid>
      <dc:creator>spjuza</dc:creator>
      <dc:date>2022-11-10T17:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Double AGGR Function in a Table</title>
      <link>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003324#M83073</link>
      <description>&lt;P&gt;as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;temp:&lt;BR /&gt;load *,recno() as ID inline [&lt;BR /&gt;ProductID|Feature 1|Quanity|Spend&lt;BR /&gt;1|1|100|$1000&lt;BR /&gt;1|1|100|$1500&lt;BR /&gt;2|1|20|$220&lt;BR /&gt;]&lt;BR /&gt;(delimiter is '|');&lt;/P&gt;
&lt;P&gt;exit Script;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Dimensions&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;ID, ProductID,Feature1&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Measures&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Quantity&amp;nbsp; = Sum(Quantity)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Spend= Sum(Spend)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Average Cost per Product ID&amp;nbsp;&lt;/SPAN&gt;=&amp;nbsp; &amp;nbsp;Sum(Spend)/ Sum(Quantity)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;50th Percentile within Product ID =&amp;nbsp;&amp;nbsp;Fractile(TOTAL &amp;lt;ProductID&amp;gt; Spend/Quanity,0.5)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;50th Percentile within Feature =&amp;nbsp;&amp;nbsp;Fractile(TOTAL &amp;lt;[Feature 1]&amp;gt; Spend/Quanity,0.5)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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="Picture1.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/93465iEEF94AE4647B6026/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 03:14:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Double-AGGR-Function-in-a-Table/m-p/2003324#M83073</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-11-11T03:14:32Z</dc:date>
    </item>
  </channel>
</rss>

