<?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 Set Analysis with Rank() Function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Rank-Function/m-p/425134#M484892</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a straight table which has a single row per location, and then obviously some metrics per each location.&amp;nbsp; I am trying to add a Rank column which ranks each location against a certain metric.&amp;nbsp; If I create an expression as below;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(Rank(Sum({1}[TY Net Sales Dollars])),Location)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great, and ensures that even if I make a selection which limits the number of locations visible in the straight table, the rank is still the rank across all locations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, I don't want to rank on just TY Net Sales, I want to rank on YTD Change TY vs LY, for which I have an expression working correctly;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=(sum({$&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [TY Net Sales Dollars])&lt;/P&gt;&lt;P&gt; / sum({$&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [LY Net Sales Dollars])) - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is my understanding that this {1} in the first expression is what causes it to always rank across all locations, so my question is how can I keep this in my rank expression, while using the calculation in my second expression instead just "TY Net Sales Dollars"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 May 2013 20:13:27 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-05-03T20:13:27Z</dc:date>
    <item>
      <title>Set Analysis with Rank() Function</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Rank-Function/m-p/425134#M484892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a straight table which has a single row per location, and then obviously some metrics per each location.&amp;nbsp; I am trying to add a Rank column which ranks each location against a certain metric.&amp;nbsp; If I create an expression as below;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(Rank(Sum({1}[TY Net Sales Dollars])),Location)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great, and ensures that even if I make a selection which limits the number of locations visible in the straight table, the rank is still the rank across all locations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, I don't want to rank on just TY Net Sales, I want to rank on YTD Change TY vs LY, for which I have an expression working correctly;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=(sum({$&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [TY Net Sales Dollars])&lt;/P&gt;&lt;P&gt; / sum({$&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [LY Net Sales Dollars])) - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is my understanding that this {1} in the first expression is what causes it to always rank across all locations, so my question is how can I keep this in my rank expression, while using the calculation in my second expression instead just "TY Net Sales Dollars"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2013 20:13:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Rank-Function/m-p/425134#M484892</guid>
      <dc:creator />
      <dc:date>2013-05-03T20:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis with Rank() Function</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Rank-Function/m-p/425135#M484893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understood correctly, just replace the set identifier $ (i.e. the current selection set) with 1 (the full record set):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;=(sum({&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [TY Net Sales Dollars])&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;/ sum({&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [LY Net Sales Dollars])) - 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;=Aggr(Rank(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;(sum({&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [TY Net Sales Dollars])&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;/ sum({&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;[Fiscal Year Id] = {2012}, [Fiscal Month of Year Id]={'&amp;lt;=$(vMaxMonthOfYearId)'}&amp;gt;} [LY Net Sales Dollars])) - 1&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;),Location)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2013 22:43:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Rank-Function/m-p/425135#M484893</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-05-03T22:43:31Z</dc:date>
    </item>
  </channel>
</rss>

