<?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: Aggr / Rank / top? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1511954#M600140</link>
    <description>&lt;P&gt;Perhaps this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rank(Sum(Sales))&amp;nbsp;&lt;FONT color="#008000"&gt;//This is&amp;nbsp;enough for you, I believe&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Or&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(Rank(Sum(Sales)), Category, [Product Group]))&amp;nbsp;&lt;FONT color="#008000"&gt;//This is only for cells of rows including Sub Total&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Or&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aggr(Rank(Sum(Sales)), Category, [Product Group]) &lt;FONT color="#008000"&gt;//This is only for cells of rows&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Nov 2018 05:00:44 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2018-11-26T05:00:44Z</dc:date>
    <item>
      <title>Aggr / Rank / top?</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1511945#M600139</link>
      <description>&lt;P&gt;I have a chart&amp;nbsp; (pivot table) which shows the detail information of a transaction (the trx no, sale amount, product category, product group, product name ...)&lt;/P&gt;&lt;P&gt;I want to add a new field to calculate the ranking of the total sale amount grouped by category and product group.&lt;/P&gt;&lt;P&gt;Search the forum and found many experts mentions the use of aggr and rank but have no ideas on it.&lt;/P&gt;&lt;P&gt;Any advice is welcomed.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 04:14:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1511945#M600139</guid>
      <dc:creator>yipchunyu</dc:creator>
      <dc:date>2018-11-26T04:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr / Rank / top?</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1511954#M600140</link>
      <description>&lt;P&gt;Perhaps this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rank(Sum(Sales))&amp;nbsp;&lt;FONT color="#008000"&gt;//This is&amp;nbsp;enough for you, I believe&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Or&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(Rank(Sum(Sales)), Category, [Product Group]))&amp;nbsp;&lt;FONT color="#008000"&gt;//This is only for cells of rows including Sub Total&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Or&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aggr(Rank(Sum(Sales)), Category, [Product Group]) &lt;FONT color="#008000"&gt;//This is only for cells of rows&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 05:00:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1511954#M600140</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-11-26T05:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr / Rank / top?</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1512003#M600141</link>
      <description>&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Would you pls help to elaborate a little bit more of the 2 and 3 options?&lt;/P&gt;&lt;P&gt;For some case, the option 2 will return some numbers e.g. 1.5 (which I think it's odd for ranking).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Ranking&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Sum(Aggr(Rank(Sum(Sales)), Category, [Product Group]))&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Aggr(Rank(Sum(Sales)), Category, [Product Group])&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*******&lt;BR /&gt;And as if i create a new expression like below:&lt;BR /&gt;aggr(Sum(&lt;STRONG&gt;Sales&lt;/STRONG&gt;), &lt;STRONG&gt;Category, [Product Group]&lt;/STRONG&gt;), the calculated total only present in a few rows.&amp;nbsp; What's the logic?&lt;BR /&gt;&lt;BR /&gt;Found the keyword&amp;nbsp;&lt;SPAN&gt;Nodistinct&amp;nbsp; should be used in this case, just record here for other reference.&amp;nbsp;&lt;BR /&gt;*******&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 07:32:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1512003#M600141</guid>
      <dc:creator>yipchunyu</dc:creator>
      <dc:date>2018-11-26T07:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr / Rank / top?</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1512209#M600142</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/402"&gt;@yipchunyu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Would you pls help to elaborate a little bit more of the 2 and 3 options?&lt;/P&gt;&lt;P&gt;For some case, the option 2 will return some numbers e.g. 1.5 (which I think it's odd for ranking).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Ranking&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Sum(Aggr(Rank(Sum(Sales)), Category, [Product Group]))&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Aggr(Rank(Sum(Sales)), Category, [Product Group])&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;TD&gt;1-2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If two rows have the same Sum(Sales), the Rank divides the ranking on the two rows. There&amp;nbsp;is a parameter within the Rank() function which you can use to get different values of rank when you run into those situations. I will look here to understand Rank() function here&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/RankingFunctions/rank.htm" target="_blank"&gt;Rank Function&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/402"&gt;@yipchunyu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;And as if i create a new expression like below:&lt;BR /&gt;aggr(Sum(&lt;STRONG&gt;Sales&lt;/STRONG&gt;), &lt;STRONG&gt;Category, [Product Group]&lt;/STRONG&gt;), the calculated total only present in a few rows.&amp;nbsp; What's the logic?&lt;BR /&gt;&lt;BR /&gt;Found the keyword&amp;nbsp;&lt;SPAN&gt;Nodistinct&amp;nbsp; should be used in this case, just record here for other reference.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If you more than 2 dimension in your chart and you are using the above expression, you can run into an issue which is called grain mismatch. You already found a work around (NODISTINCT), but read more on this here&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Pitfalls-of-the-Aggr-function/ba-p/1463275" target="_blank"&gt;Pitfalls of the Aggr function&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 12:48:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1512209#M600142</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-26T12:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr / Rank / top?</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1512551#M600143</link>
      <description>&lt;P&gt;Thanks a lot for all the advice and knowledge sharing.&lt;/P&gt;&lt;P&gt;I tried to apply the rank in other cases but got issues again (so sorry).&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;COMPANY_NAME&lt;/TD&gt;&lt;TD&gt;QUARTER&lt;/TD&gt;&lt;TD&gt;TYPE&lt;/TD&gt;&lt;TD&gt;YTQ_USD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;9,832&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;1,158,893&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;198,191&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;G&lt;/TD&gt;&lt;TD&gt;2018Q2&lt;/TD&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;98,876&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will select the Quarter and&amp;nbsp; type (including, total, channel1, channel2 ...) and then the column YTQ_USD will calculate the amount for that company by quarter by type.&lt;/P&gt;&lt;P&gt;I simply want to add a ranking by (YTQ_USD) by it doesn't work. (which either 1 or 0 being shown).&lt;/P&gt;&lt;P&gt;Anything goes wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;##update&lt;/P&gt;&lt;P&gt;Just trial and error and found below expression seems to work but can't fully understand the logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Aggr(NODISTINCT Rank(Sum({$} #YTQ_USD)), COMPANY_NAME)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 02:40:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Rank-top/m-p/1512551#M600143</guid>
      <dc:creator>yipchunyu</dc:creator>
      <dc:date>2018-11-27T02:40:12Z</dc:date>
    </item>
  </channel>
</rss>

