<?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 Display N rows by group in straight table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Display-N-rows-by-group-in-straight-table/m-p/219774#M72759</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;I've a problem on displaying a subset of rows per group of rows in a straight table.&lt;/P&gt;&lt;P&gt;My straight table has 2 dimensions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;BrandTypology (like Coffee, Garments, Cosmetics...)&lt;/LI&gt;&lt;LI&gt;Brand (a number of company names producing coffee, garments, cosmetics...)&lt;/LI&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I need to display all the brand typologies and only some relevant brands.&lt;/P&gt;&lt;P&gt;The Brand expression is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;=if(&lt;BR /&gt; aggr(sum(wSampleBrand), BrandTypology,Brand) &amp;gt;= 50&lt;BR /&gt; and aggr(max(wAffinityBrand),BrandTypology,Brand) &amp;gt;= 110,&lt;BR /&gt; Brand&lt;BR /&gt;)&lt;/P&gt;&lt;DIV&gt;The valid brands are those:&lt;/DIV&gt;&lt;DIV&gt;&lt;OL&gt;&lt;LI&gt;with SAMPLE value &amp;gt;= 50&lt;/LI&gt;&lt;LI&gt;with AFFINITY index &amp;gt;= 110&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;DIV&gt;In this case I end up with a table of brand typologies and way too many different brands associated to the typology and satisfying the filter criteria.&lt;/DIV&gt;&lt;DIV&gt;The problem is that in no way do I manage to leave only TOP N brands per BrandTypology.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried using MAX NUMBER but it limits the total number of rows in the table ignoring the BrandTypology dimension. So, unacceptable.&lt;/DIV&gt;&lt;DIV&gt;I've tried adding another filter condition to the Brand dimension making it look like this:&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;B&gt;=if(&lt;BR /&gt; aggr(sum(wSampleBrand), BrandTypology,Brand) &amp;gt;= 50&lt;BR /&gt; and aggr(max(wAffinityBrand),BrandTypology,Brand) &amp;gt;= 110&lt;BR /&gt;&lt;/B&gt; &lt;B&gt;and aggr(rank(wAffinityBrand),BrandTypology,Brand) &amp;lt;= 5,&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;Brand&lt;BR /&gt;)&lt;/P&gt;&lt;DIV&gt;But the last aggregation does not take into account the previous conditions (it simply keeps assigning ranks to the brands that do not satisfy previous conditions and are therefore already excluded). So, the result is one BrandTypology has 5 rows, another has 3 rows, still another has just 0 ones. And setting the number from 5 to 7 I suddenly discover a new row appear on the third BrandTypology which previously had 0 rows. That's not a correct TOP N functionality.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried &lt;B&gt;rowno()&lt;/B&gt; and &lt;B&gt;noofrows()&lt;/B&gt; functions but they do not seem working inside the dimension expression.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried &lt;B&gt;above()&lt;/B&gt; function but still with the same negative result.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is there a way to solve the problem?&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 10 Jul 2010 20:43:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-10T20:43:25Z</dc:date>
    <item>
      <title>Display N rows by group in straight table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-N-rows-by-group-in-straight-table/m-p/219774#M72759</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;I've a problem on displaying a subset of rows per group of rows in a straight table.&lt;/P&gt;&lt;P&gt;My straight table has 2 dimensions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;BrandTypology (like Coffee, Garments, Cosmetics...)&lt;/LI&gt;&lt;LI&gt;Brand (a number of company names producing coffee, garments, cosmetics...)&lt;/LI&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I need to display all the brand typologies and only some relevant brands.&lt;/P&gt;&lt;P&gt;The Brand expression is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;=if(&lt;BR /&gt; aggr(sum(wSampleBrand), BrandTypology,Brand) &amp;gt;= 50&lt;BR /&gt; and aggr(max(wAffinityBrand),BrandTypology,Brand) &amp;gt;= 110,&lt;BR /&gt; Brand&lt;BR /&gt;)&lt;/P&gt;&lt;DIV&gt;The valid brands are those:&lt;/DIV&gt;&lt;DIV&gt;&lt;OL&gt;&lt;LI&gt;with SAMPLE value &amp;gt;= 50&lt;/LI&gt;&lt;LI&gt;with AFFINITY index &amp;gt;= 110&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;DIV&gt;In this case I end up with a table of brand typologies and way too many different brands associated to the typology and satisfying the filter criteria.&lt;/DIV&gt;&lt;DIV&gt;The problem is that in no way do I manage to leave only TOP N brands per BrandTypology.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried using MAX NUMBER but it limits the total number of rows in the table ignoring the BrandTypology dimension. So, unacceptable.&lt;/DIV&gt;&lt;DIV&gt;I've tried adding another filter condition to the Brand dimension making it look like this:&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;B&gt;=if(&lt;BR /&gt; aggr(sum(wSampleBrand), BrandTypology,Brand) &amp;gt;= 50&lt;BR /&gt; and aggr(max(wAffinityBrand),BrandTypology,Brand) &amp;gt;= 110&lt;BR /&gt;&lt;/B&gt; &lt;B&gt;and aggr(rank(wAffinityBrand),BrandTypology,Brand) &amp;lt;= 5,&lt;/B&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;Brand&lt;BR /&gt;)&lt;/P&gt;&lt;DIV&gt;But the last aggregation does not take into account the previous conditions (it simply keeps assigning ranks to the brands that do not satisfy previous conditions and are therefore already excluded). So, the result is one BrandTypology has 5 rows, another has 3 rows, still another has just 0 ones. And setting the number from 5 to 7 I suddenly discover a new row appear on the third BrandTypology which previously had 0 rows. That's not a correct TOP N functionality.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried &lt;B&gt;rowno()&lt;/B&gt; and &lt;B&gt;noofrows()&lt;/B&gt; functions but they do not seem working inside the dimension expression.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried &lt;B&gt;above()&lt;/B&gt; function but still with the same negative result.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Is there a way to solve the problem?&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Jul 2010 20:43:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-N-rows-by-group-in-straight-table/m-p/219774#M72759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-10T20:43:25Z</dc:date>
    </item>
  </channel>
</rss>

