<?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 Aggregate rank in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52664#M8755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much Marcus. It works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2018 15:43:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-04-05T15:43:22Z</dc:date>
    <item>
      <title>Double Aggregate rank</title>
      <link>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52661#M8752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table containing two KPIs that I need to aggregate twice and sum the result. I want to do this in a textbox expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Category1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Category2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;KPI1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;KPI2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;D&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this, I have to aggregate once according to a rank that identifies the worst performers (largest values) for KPI1 and secondly for the worst performers of KPI2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The two steps:&lt;/P&gt;&lt;P&gt;- Reduce the table down to the worst 40% of KPI1&lt;/P&gt;&lt;P&gt;- Reduce this down to the worst 50% of KPI2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I started out with just limiting the table to the worst 40% of KPI1 which worked with the following expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr(if(rank(TOTAL KPI1) &amp;lt;= NoOfRows(TOTAL)*0.4,KPI1),Category1, Category2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I would need a second aggregation that again ranks this first aggr() according to KPI2.&lt;/P&gt;&lt;P&gt;I used this expression but it doesn't return the right value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;SPAN style="font-size: 10pt;"&gt;aggr(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;if(rank(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;aggr(if(rank(TOTAL KPI1) &amp;lt;= NoOfRows(TOTAL)*0.4,KPI2),Category 1, Category 2) &amp;lt;= NoOfRows(TOTAL)*0.5, KPI2), C&lt;/SPAN&gt;ategory 1, Category 2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I solve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 10:52:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52661#M8752</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-04T10:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Double Aggregate rank</title>
      <link>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52662#M8753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might be helpful to look at a slightly bigger sample data and the expected number you expect to see out from it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 11:21:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52662#M8753</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-04-04T11:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Double Aggregate rank</title>
      <link>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52663#M8754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not absolutely sure if I had understood your question right but I think even if not the following would be helpful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load * inline [&lt;/P&gt;&lt;P&gt;C1, C2, K1, K2&lt;/P&gt;&lt;P&gt;a, b, 1, 1&lt;/P&gt;&lt;P&gt;c, d, 2, 2&lt;/P&gt;&lt;P&gt;e, f, 3, 4&lt;/P&gt;&lt;P&gt;g, h, 4, 8&lt;/P&gt;&lt;P&gt;i, j, 5, 16&lt;/P&gt;&lt;P&gt;k, l, 6, 32&lt;/P&gt;&lt;P&gt;m, n, 7, 64&lt;/P&gt;&lt;P&gt;o, p, 8, 128&lt;/P&gt;&lt;P&gt;q, r, 9, 256&lt;/P&gt;&lt;P&gt;s, t, 10, 1024&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;nbsp; sum(aggr(if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rank(total&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(aggr(if(rank(TOTAL sum(K1)) &amp;lt;= NoOfRows(TOTAL)*0.4,K1),C1, C2)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;= NoOfRows(TOTAL)*0.4*0.5, K2),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; C1, C2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/198411_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:03:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52663#M8754</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-04-04T12:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Double Aggregate rank</title>
      <link>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52664#M8755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much Marcus. It works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 15:43:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-Aggregate-rank/m-p/52664#M8755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-05T15:43:22Z</dc:date>
    </item>
  </channel>
</rss>

