<?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: Straight Table Ranking order in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Straight-Table-Ranking-order/m-p/2099474#M1224323</link>
    <description>&lt;P&gt;The pivot has also the feature of totals which is called partial sums and you could enable it within the tab presentation in the top left area.&lt;/P&gt;
&lt;P&gt;Another thought goes to the missing outer-aggregation of your ranking which didn't result in an aggregation-expression else in a calculated dimension. Therefore you may adjust it in the following way:&lt;/P&gt;
&lt;P&gt;sum(aggr(rank(sum()), Dim1, Dim2)) or maybe:&amp;nbsp;aggr(&lt;STRONG&gt;NODISTINCT&lt;/STRONG&gt; rank(sum()), Dim1, Dim2))&lt;/P&gt;
&lt;P&gt;Beside this the sorting of a multi-dimensional table could become quite tricky and you may need a separate sorting-expression for each dimension.&lt;/P&gt;
&lt;P&gt;I didn't such things since ages and don't remember my doings very well unless that I also had some struggles. I think I ended it by using calculated dimensions which already contained the needed sorting and looked probably similar to this:&lt;/P&gt;
&lt;P&gt;aggr(dual(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if(rank(sum(Field))&amp;lt;=$(var), Dim1, 'Others'),&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if(rank(sum(Field))&amp;lt;=$(var), rank(sum(Field)), $(var) + 1)), &lt;BR /&gt;Dim1)&lt;/P&gt;
&lt;P&gt;which enabled also the possibility to include all others as group and to display their sums and rates, too.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Aug 2023 11:04:13 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2023-08-02T11:04:13Z</dc:date>
    <item>
      <title>Straight Table Ranking order</title>
      <link>https://community.qlik.com/t5/QlikView/Straight-Table-Ranking-order/m-p/2099330#M1224314</link>
      <description>&lt;P&gt;Good day.&lt;/P&gt;
&lt;P&gt;I have a situation where I have a dataset for a Company with many outlets, Sites, with Items. I am trying to show the top 5, 5 is set in a variable vTop, Items sold per Site in the last 7 days.&lt;/P&gt;
&lt;P&gt;In the attached PNG file I show a straight table as well as a pivot table, both using the same expressions.&lt;/P&gt;
&lt;P&gt;In the straight table the ranking is a calculated dimension where in the pivot table the ranking is an expression. The Company marked in black in both tables’s ranking is &lt;STRONG&gt;not&lt;/STRONG&gt; &lt;STRONG&gt;correct&lt;/STRONG&gt; in the straight table but i&lt;STRONG&gt;s correct&lt;/STRONG&gt; in the pivot.&lt;/P&gt;
&lt;P&gt;Please can anyone check these expressions and tell me what I am doing wrong.&lt;/P&gt;
&lt;P&gt;I am using the straight table in the final App, because of the sub-totals, but if totals can be added to the pivot table that is also a big win.&lt;/P&gt;
&lt;P&gt;The Ranking expression is - The Itname sort uses the same ranking expression in the straight table:&lt;/P&gt;
&lt;P&gt;=if(aggr(rank(sum({&amp;lt;Date={"&amp;gt;$(=date(Today()-7))&amp;lt;=$(=date(Today()-1))"}&amp;gt;} Amt)),Site,Itname)&amp;lt;=&lt;STRONG&gt;&lt;EM&gt;$(vTop)&lt;/EM&gt;&lt;/STRONG&gt;,&lt;BR /&gt;aggr(rank(sum({&amp;lt;Date={"&amp;gt;$(=date(Today()-7))&amp;lt;=$(=date(Today()-1))"}&amp;gt;} Amt)),Site,Itname),null())&lt;/P&gt;
&lt;P&gt;The Sales expression is:&lt;/P&gt;
&lt;P&gt;=sum({&amp;lt;Date={"&amp;gt;$(=date(Today()-7))&amp;lt;=$(=date(Today()-1))"}&amp;gt;} Amt)&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Straight and Pivot  tables" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/113395i3BFB31DCA80FA48E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Straight - Pivot Table Ranking.PNG" alt="Straight and Pivot  tables" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Straight and Pivot  tables&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 02:32:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Straight-Table-Ranking-order/m-p/2099330#M1224314</guid>
      <dc:creator>johngouws</dc:creator>
      <dc:date>2023-08-02T02:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Straight Table Ranking order</title>
      <link>https://community.qlik.com/t5/QlikView/Straight-Table-Ranking-order/m-p/2099474#M1224323</link>
      <description>&lt;P&gt;The pivot has also the feature of totals which is called partial sums and you could enable it within the tab presentation in the top left area.&lt;/P&gt;
&lt;P&gt;Another thought goes to the missing outer-aggregation of your ranking which didn't result in an aggregation-expression else in a calculated dimension. Therefore you may adjust it in the following way:&lt;/P&gt;
&lt;P&gt;sum(aggr(rank(sum()), Dim1, Dim2)) or maybe:&amp;nbsp;aggr(&lt;STRONG&gt;NODISTINCT&lt;/STRONG&gt; rank(sum()), Dim1, Dim2))&lt;/P&gt;
&lt;P&gt;Beside this the sorting of a multi-dimensional table could become quite tricky and you may need a separate sorting-expression for each dimension.&lt;/P&gt;
&lt;P&gt;I didn't such things since ages and don't remember my doings very well unless that I also had some struggles. I think I ended it by using calculated dimensions which already contained the needed sorting and looked probably similar to this:&lt;/P&gt;
&lt;P&gt;aggr(dual(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if(rank(sum(Field))&amp;lt;=$(var), Dim1, 'Others'),&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if(rank(sum(Field))&amp;lt;=$(var), rank(sum(Field)), $(var) + 1)), &lt;BR /&gt;Dim1)&lt;/P&gt;
&lt;P&gt;which enabled also the possibility to include all others as group and to display their sums and rates, too.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 11:04:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Straight-Table-Ranking-order/m-p/2099474#M1224323</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-08-02T11:04:13Z</dc:date>
    </item>
  </channel>
</rss>

