<?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 Complicated Top 'x' Dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371252#M493689</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem here is that you validate two separate conditions - the Rank and the Margin. Only 2 out of the top 10 Dimensions can show Gross Margin over 1000. Assuming that you have more "dimension" values with high margins, your goal is to only include those values in your Ranking that satisfy the Margin requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following. This has not been tested, so use it "as is":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; color: #0000ff;"&gt;=aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #0000ff;"&gt;rank&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #0000ff;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt; Dimension1 = {"=sum([Gross Margin]) &amp;gt;1000"}&amp;nbsp;&amp;nbsp; &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #800000;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),4,1) &amp;lt; 11 ,&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #800000;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #800000;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;The Set Analysis condition inside the Sum(Units) &lt;STRONG&gt;should&lt;/STRONG&gt; cause including only those "dimensions" with the high margin, in the ranking.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Hope it works for you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Oleg &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Apr 2012 01:23:26 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2012-04-27T01:23:26Z</dc:date>
    <item>
      <title>Complicated Top 'x' Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371250#M493687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;In my pivot tables I frequently use an expression like below in one of my dimensions to return the top 'x':&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;=aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;rank&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),4,1) &amp;lt; 11,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;This is pretty straight forward, after I select "Do not show null values" it will only return dimensions that aggregated have the top 10 Units.&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;My question is how would I answer ...&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;"I need the top 10 based on Units BUT their Gross Margin must be over 1000"?&amp;nbsp; I've been trying all sorts of things and it won't work.&amp;nbsp; This will return only the one or two that qualify for top 10 Units and have a Gross Margin over 1000.&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;=aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;rank&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),4,1) &amp;lt; 11 AND sum([Gross Margin]) &amp;gt; 1000,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;I even tried embedding another if within an if and it doesn't work:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;=aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;rank&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(if(sum([Gross Margin]) &amp;gt; 1000,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Units)&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),4,1) &amp;lt; 11,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;Could set analysis play a role here, possible the P() function?&amp;nbsp; Any suggestions would be appreciated.&amp;nbsp; Thanks! &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2012 21:58:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371250#M493687</guid>
      <dc:creator />
      <dc:date>2012-04-26T21:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Complicated Top 'x' Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371251#M493688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To accomplish what you are looking for, you need to evaluate the Gross Margin threshold before doing the ranking at all; otherwise you will only get Dimension1 values that meet both criteria (what your AND is doing now).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neither approach is particularly efficient, but have you considered moving that logic to the expressions instead of the dimensions? Pivot tables are already resource-intensive enough before introducing calculated dimensions, especially involving the aggr function. Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;If(Sum(TOTAL &amp;lt;Dimension1&amp;gt; Margin) &amp;gt; 1000,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Rank(Sum(TOTAL &amp;lt;Dimension1&amp;gt; Units),4,1) &amp;lt; 11,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(Margin)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It could likely be accomplished using P() in set analysis, but it wouldn't be much prettier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 01:17:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371251#M493688</guid>
      <dc:creator>msteedle</dc:creator>
      <dc:date>2012-04-27T01:17:33Z</dc:date>
    </item>
    <item>
      <title>Complicated Top 'x' Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371252#M493689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem here is that you validate two separate conditions - the Rank and the Margin. Only 2 out of the top 10 Dimensions can show Gross Margin over 1000. Assuming that you have more "dimension" values with high margins, your goal is to only include those values in your Ranking that satisfy the Margin requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following. This has not been tested, so use it "as is":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11px; color: #0000ff;"&gt;=aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #0000ff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #0000ff;"&gt;rank&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #0000ff;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt; Dimension1 = {"=sum([Gross Margin]) &amp;gt;1000"}&amp;nbsp;&amp;nbsp; &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #800000;"&gt;Units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),4,1) &amp;lt; 11 ,&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #800000;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; color: #800000;"&gt;Dimension1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;The Set Analysis condition inside the Sum(Units) &lt;STRONG&gt;should&lt;/STRONG&gt; cause including only those "dimensions" with the high margin, in the ranking.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Hope it works for you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Oleg &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 01:23:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371252#M493689</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2012-04-27T01:23:26Z</dc:date>
    </item>
    <item>
      <title>Complicated Top 'x' Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371253#M493690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Michael/Oleg - You guys are great, both solutions work!&amp;nbsp; Michael I hadn't even thought of using the TOTAl operator in my expression.&amp;nbsp; Oleg passing the results of an expression to the set analysis is brilliant using the double quotes.&amp;nbsp; Thanks again, I learned a lot with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 16:00:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complicated-Top-x-Dimension/m-p/371253#M493690</guid>
      <dc:creator />
      <dc:date>2012-04-27T16:00:43Z</dc:date>
    </item>
  </channel>
</rss>

