<?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 Conditional within rank/agg in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297547#M110370</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a lot of data on insurance policies. I have a table showing the top 10 policies by premium. Here's my function for the dimension:&lt;/P&gt;&lt;P&gt;=if(aggr(rank(Premium), Year)&amp;lt;11, Policy_Nbr)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was asked to only show recent policies - let's say in the last year. I have a field which shows when the policy was written, which is called pol_date. Any idea on how I can limit that function only to the last year? I created a variable called vRecentDate which is set to =max(pol_date) - that way when filters are applied, the value of the recet date will update to the data being looked at. But how do I work it into the original function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Aug 2011 13:43:13 GMT</pubDate>
    <dc:creator>danielact</dc:creator>
    <dc:date>2011-08-24T13:43:13Z</dc:date>
    <item>
      <title>Conditional within rank/agg</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297547#M110370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a lot of data on insurance policies. I have a table showing the top 10 policies by premium. Here's my function for the dimension:&lt;/P&gt;&lt;P&gt;=if(aggr(rank(Premium), Year)&amp;lt;11, Policy_Nbr)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was asked to only show recent policies - let's say in the last year. I have a field which shows when the policy was written, which is called pol_date. Any idea on how I can limit that function only to the last year? I created a variable called vRecentDate which is set to =max(pol_date) - that way when filters are applied, the value of the recet date will update to the data being looked at. But how do I work it into the original function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 13:43:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297547#M110370</guid>
      <dc:creator>danielact</dc:creator>
      <dc:date>2011-08-24T13:43:13Z</dc:date>
    </item>
    <item>
      <title>Conditional within rank/agg</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297548#M110371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Wil this help you?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=if(aggr(rank(Sum({&amp;lt;Year = {"$(=Year(Max(pol_date))-1)"}&amp;gt;} Premium)), Year)&amp;lt;11, Policy_Nbr)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If this is not helping you, pl post your sample data.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;-Sridhar&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 14:00:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297548#M110371</guid>
      <dc:creator>sridhar240784</dc:creator>
      <dc:date>2011-08-24T14:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional within rank/agg</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297549#M110372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, that doesn't help. I realized an error in my original script and corrected it (I was summing ALL premium instead of taking only the one year).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm attaching an example of it. I want to be able to limit the year to only the latest one - take the max of the dates, and go back one year from it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 15:50:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297549#M110372</guid>
      <dc:creator>danielact</dc:creator>
      <dc:date>2011-08-24T15:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional within rank/agg</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297550#M110373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Hi,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Check out the attached application.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Your Expression should be like below.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;aggr(rank(Sum({&amp;lt;UW_Year = {"$(=Max(UW_Year))"}&amp;gt;} Premium)), Contract_Year)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Hope this helps you.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;-Sridhar&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 10:02:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-within-rank-agg/m-p/297550#M110373</guid>
      <dc:creator>sridhar240784</dc:creator>
      <dc:date>2011-08-25T10:02:32Z</dc:date>
    </item>
  </channel>
</rss>

