<?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 Showing top N items horizontally in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834152#M1214769</link>
    <description>&lt;P&gt;Hi&lt;BR /&gt;Currently I have a straight table showing Top 5 most sold items for each Customer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jstensig_0-1630995501691.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/61440i6F421B214435EA79/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jstensig_0-1630995501691.png" alt="jstensig_0-1630995501691.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However I´ve been asked to show it a bit different as shown below&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jstensig_1-1630995559603.png" style="width: 428px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/61441iAF975EEDEE015B9D/image-dimensions/428x89?v=v2" width="428" height="89" role="button" title="jstensig_1-1630995559603.png" alt="jstensig_1-1630995559603.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Still I think it should be a straight table with dimensions CustomerNo and CustomerName, and then 5 expressions, one for each of the 5 rankings&lt;/P&gt;&lt;P&gt;My "not working" try for Rank 1:&lt;BR /&gt;If(Rank(Aggr(Sum(Sales), ItemNo, CustomerNo )) =1 , only(ItemNo))&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 13:28:27 GMT</pubDate>
    <dc:creator>jstensig</dc:creator>
    <dc:date>2021-09-07T13:28:27Z</dc:date>
    <item>
      <title>Showing top N items horizontally</title>
      <link>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834152#M1214769</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;Currently I have a straight table showing Top 5 most sold items for each Customer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jstensig_0-1630995501691.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/61440i6F421B214435EA79/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jstensig_0-1630995501691.png" alt="jstensig_0-1630995501691.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However I´ve been asked to show it a bit different as shown below&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jstensig_1-1630995559603.png" style="width: 428px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/61441iAF975EEDEE015B9D/image-dimensions/428x89?v=v2" width="428" height="89" role="button" title="jstensig_1-1630995559603.png" alt="jstensig_1-1630995559603.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Still I think it should be a straight table with dimensions CustomerNo and CustomerName, and then 5 expressions, one for each of the 5 rankings&lt;/P&gt;&lt;P&gt;My "not working" try for Rank 1:&lt;BR /&gt;If(Rank(Aggr(Sum(Sales), ItemNo, CustomerNo )) =1 , only(ItemNo))&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 13:28:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834152#M1214769</guid>
      <dc:creator>jstensig</dc:creator>
      <dc:date>2021-09-07T13:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Showing top N items horizontally</title>
      <link>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834710#M1214789</link>
      <description>&lt;P&gt;I believe that your approach might not give you the desired outcome. In this use case scenario you will need to use a Pivot Table in combination with set analysis. I don't have the same dataset as you do, however I managed to transfer the Straight Table as you have, into a Pivot Table and the outcome is the one that you are looking for. Here are the steps that I have followed, after that you can follow the same approach on your side:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have loaded simply the data that you showed in the screenshot with "LOAD * INLINE" statement and this is the resulted table:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/a7673a2d-557a-41fc-94aa-1c484d1b348c.default.PNG" /&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Then I have created a new Pivot Table with the following dimensions:&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/203e33cb-5f9b-4dad-8beb-901e697e0b35.default.png" /&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;After that I have created the following expressions:&lt;/P&gt;

&lt;OL&gt;
 &lt;LI&gt;Label:&amp;nbsp;&lt;SPAN style="color:#27ae60"&gt;&lt;STRONG&gt;Rank 1&lt;/STRONG&gt;&lt;/SPAN&gt;, Definition:&amp;nbsp;&lt;SPAN style="color:#2980b9"&gt;&lt;STRONG&gt;Only({&amp;lt;Rank={1}&amp;gt;} ItemNo)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
 &lt;LI&gt;Label:&amp;nbsp;&lt;SPAN style="color:#27ae60"&gt;&lt;STRONG&gt;Rank 2&lt;/STRONG&gt;&lt;/SPAN&gt;, Definition:&amp;nbsp;&lt;SPAN style="color:#2980b9"&gt;&lt;STRONG&gt;Only({&amp;lt;Rank={2}&amp;gt;} ItemNo)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
 &lt;LI&gt;Label:&amp;nbsp;&lt;SPAN style="color:#27ae60"&gt;&lt;STRONG&gt;Rank 3&lt;/STRONG&gt;&lt;/SPAN&gt;, Definition:&amp;nbsp;&lt;SPAN style="color:#2980b9"&gt;&lt;STRONG&gt;Only({&amp;lt;Rank={3}&amp;gt;} ItemNo)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
 &lt;LI&gt;Label:&amp;nbsp;&lt;SPAN style="color:#27ae60"&gt;&lt;STRONG&gt;Rank 4&lt;/STRONG&gt;&lt;/SPAN&gt;, Definition:&amp;nbsp;&lt;SPAN style="color:#2980b9"&gt;&lt;STRONG&gt;Only({&amp;lt;Rank={4}&amp;gt;} ItemNo)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
 &lt;LI&gt;Label:&amp;nbsp;&lt;SPAN style="color:#27ae60"&gt;&lt;STRONG&gt;Rank 5&lt;/STRONG&gt;&lt;/SPAN&gt;, Definition:&amp;nbsp;&lt;SPAN style="color:#2980b9"&gt;&lt;STRONG&gt;Only({&amp;lt;Rank={5}&amp;gt;} ItemNo)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;&lt;IMG src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/ae69b21a-4690-4d59-b5d5-84b8a854aceb.default.png" /&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color:null"&gt;The resulted Pivot Table looks like this:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/7c5f3a0a-ae60-4744-a063-e521658cc581.default.PNG" /&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I hope that this information is helpful&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 14:54:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834710#M1214789</guid>
      <dc:creator>Andrei_Cusnir</dc:creator>
      <dc:date>2021-09-08T14:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Showing top N items horizontally</title>
      <link>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834721#M1214791</link>
      <description>&lt;P&gt;Try adding an outside &lt;U&gt;aggregation with total&lt;/U&gt; to get your ranks&lt;/P&gt;&lt;P&gt;=concat(distinct total &amp;lt;&lt;SPAN&gt;CustomerNo&lt;/SPAN&gt;, &lt;SPAN&gt;CustomerName&lt;/SPAN&gt;&amp;gt; If(aggr(nodistinct rank(&lt;SPAN&gt;Sum(Sales)&lt;/SPAN&gt;), &lt;SPAN&gt;CustomerNo&lt;/SPAN&gt;, &lt;SPAN&gt;CustomerName&lt;/SPAN&gt;, &lt;SPAN&gt;ItemNo&lt;/SPAN&gt;)=1, &lt;SPAN&gt;ItemNo&lt;/SPAN&gt;))&lt;/P&gt;&lt;P&gt;=concat(distinct total &amp;lt;&lt;SPAN&gt;CustomerNo&lt;/SPAN&gt;, &lt;SPAN&gt;CustomerName&lt;/SPAN&gt;&amp;gt; If(aggr(nodistinct rank(&lt;SPAN&gt;Sum(Sales)&lt;/SPAN&gt;), &lt;SPAN&gt;CustomerNo&lt;/SPAN&gt;, &lt;SPAN&gt;CustomerName&lt;/SPAN&gt;, &lt;SPAN&gt;ItemNo&lt;/SPAN&gt;)=2, &lt;SPAN&gt;ItemNo&lt;/SPAN&gt;))&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 15:55:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834721#M1214791</guid>
      <dc:creator>stevejoyce</dc:creator>
      <dc:date>2021-09-08T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Showing top N items horizontally</title>
      <link>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834796#M1214802</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28424"&gt;@jstensig&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try like below&lt;/P&gt;&lt;P&gt;Use Pivot table,&lt;/P&gt;&lt;P&gt;Dim1: CustomerNo&lt;/P&gt;&lt;P&gt;Dim2: CustomerName&lt;/P&gt;&lt;P&gt;Dim3:&amp;nbsp;=aggr(if(rank(Sum(&lt;SPAN&gt;Sales&lt;/SPAN&gt;))&amp;lt;=6,rank(Sum(&lt;SPAN&gt;Sales&lt;/SPAN&gt;))),CustomerNo,&lt;SPAN&gt;ItemNo&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;Exp: Only(ItemNo)&lt;/P&gt;&lt;P&gt;Then Drag the Dim3 to top .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 03:13:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834796#M1214802</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2021-09-09T03:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Showing top N items horizontally</title>
      <link>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834838#M1214806</link>
      <description>&lt;P&gt;Hi folks&lt;BR /&gt;Thank you for the different suggestions. For me the right solution was provided by Steve, as it gives the best performance in my rather large data model and good flexibility.&amp;nbsp; I still use a straight table, so I have to make an expression for each rank but I can live with that&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 06:48:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Showing-top-N-items-horizontally/m-p/1834838#M1214806</guid>
      <dc:creator>jstensig</dc:creator>
      <dc:date>2021-09-09T06:48:19Z</dc:date>
    </item>
  </channel>
</rss>

