<?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 Indirect set analysis,calculated dimension,aggr() function issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Indirect-set-analysis-calculated-dimension-aggr-function-issue/m-p/849939#M298156</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement to create a pivot table where I need to have two dimensions&lt;/P&gt;&lt;P&gt;1. Commodity&lt;/P&gt;&lt;P&gt;2. Supplier&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Measures&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Market Share &lt;/P&gt;&lt;P&gt;2. Savings&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data is in such a way that a supplier may be present in other commodities also and I have a filter supplier.&lt;/P&gt;&lt;P&gt;Initially the table should show top 5 suppliers per commodity in the table along with the market share of supplier on that commodity.&lt;/P&gt;&lt;P&gt;If any supplier is selected , the table has to show selected supplier + top 5 if the selected supplier is not in top 5 , otherwise selected supplier + 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this I used a calculated dimension for supplier to get the top 5 suppliers when selected or not selected as follows(&lt;STRONG&gt;correct me If I am wrong&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;if(GetSelectedCount(Supplier) &amp;gt; 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp; if(AGGR(RANK(Sum({1-$&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vLastQuarter3)}&amp;gt;}Spend)),[Commodity],[Supplier])&amp;lt;=5 &lt;/P&gt;&lt;P&gt;&amp;nbsp; OR&lt;/P&gt;&lt;P&gt;&amp;nbsp; AGGR(RANK(Sum({$&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2),&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vLastQuarter3)}&amp;gt;}Spend)),[Commodity],[Supplier])&amp;lt;=5, Supplier) &lt;/P&gt;&lt;P&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(AGGR(RANK(Sum({1&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend)),[Commodity],[Supplier])&amp;lt;=5, Supplier) &lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initially I was not able to get market percentages correctly per commodity and I used the following post to get it&lt;/P&gt;&lt;P&gt;&lt;A href="http://quickdevtips.blogspot.in/2012/05/qlikview-how-to-calculate-percentages.html" title="http://quickdevtips.blogspot.in/2012/05/qlikview-how-to-calculate-percentages.html"&gt;Quick Development Tips: Qlikview: Aggregation 1: How to calculate percentages at second dimension level &lt;/A&gt;&lt;/P&gt;&lt;P&gt;but the market share is showing correctly when supplier filter is not selected but when I am selecting a supplier it is showing market share for selected supplier and not showing the other top 5 or top 4(showing dashes for other suppliers market share).&lt;/P&gt;&lt;P&gt;The expression for market share is as follows&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Sum({1&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend)&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; /&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Aggr(NODISTINCT Sum({1&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend),Commodity)&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;IMG alt="market share.png" class="jive-image image-1" src="/legacyfs/online/82857_market share.png" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used p() because if this supplier is part of another commodity I also want to get that commodity with its suppliers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advice &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Apr 2015 05:48:32 GMT</pubDate>
    <dc:creator>kkkumar82</dc:creator>
    <dc:date>2015-04-03T05:48:32Z</dc:date>
    <item>
      <title>Indirect set analysis,calculated dimension,aggr() function issue</title>
      <link>https://community.qlik.com/t5/QlikView/Indirect-set-analysis-calculated-dimension-aggr-function-issue/m-p/849939#M298156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement to create a pivot table where I need to have two dimensions&lt;/P&gt;&lt;P&gt;1. Commodity&lt;/P&gt;&lt;P&gt;2. Supplier&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Measures&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Market Share &lt;/P&gt;&lt;P&gt;2. Savings&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data is in such a way that a supplier may be present in other commodities also and I have a filter supplier.&lt;/P&gt;&lt;P&gt;Initially the table should show top 5 suppliers per commodity in the table along with the market share of supplier on that commodity.&lt;/P&gt;&lt;P&gt;If any supplier is selected , the table has to show selected supplier + top 5 if the selected supplier is not in top 5 , otherwise selected supplier + 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this I used a calculated dimension for supplier to get the top 5 suppliers when selected or not selected as follows(&lt;STRONG&gt;correct me If I am wrong&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;if(GetSelectedCount(Supplier) &amp;gt; 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp; if(AGGR(RANK(Sum({1-$&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vLastQuarter3)}&amp;gt;}Spend)),[Commodity],[Supplier])&amp;lt;=5 &lt;/P&gt;&lt;P&gt;&amp;nbsp; OR&lt;/P&gt;&lt;P&gt;&amp;nbsp; AGGR(RANK(Sum({$&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2),&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(vLastQuarter3)}&amp;gt;}Spend)),[Commodity],[Supplier])&amp;lt;=5, Supplier) &lt;/P&gt;&lt;P&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(AGGR(RANK(Sum({1&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend)),[Commodity],[Supplier])&amp;lt;=5, Supplier) &lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initially I was not able to get market percentages correctly per commodity and I used the following post to get it&lt;/P&gt;&lt;P&gt;&lt;A href="http://quickdevtips.blogspot.in/2012/05/qlikview-how-to-calculate-percentages.html" title="http://quickdevtips.blogspot.in/2012/05/qlikview-how-to-calculate-percentages.html"&gt;Quick Development Tips: Qlikview: Aggregation 1: How to calculate percentages at second dimension level &lt;/A&gt;&lt;/P&gt;&lt;P&gt;but the market share is showing correctly when supplier filter is not selected but when I am selecting a supplier it is showing market share for selected supplier and not showing the other top 5 or top 4(showing dashes for other suppliers market share).&lt;/P&gt;&lt;P&gt;The expression for market share is as follows&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Sum({1&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend)&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp; /&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Aggr(NODISTINCT Sum({1&amp;lt;Commodity=p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend),Commodity)&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;IMG alt="market share.png" class="jive-image image-1" src="/legacyfs/online/82857_market share.png" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used p() because if this supplier is part of another commodity I also want to get that commodity with its suppliers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advice &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kiran Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 05:48:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Indirect-set-analysis-calculated-dimension-aggr-function-issue/m-p/849939#M298156</guid>
      <dc:creator>kkkumar82</dc:creator>
      <dc:date>2015-04-03T05:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Indirect set analysis,calculated dimension,aggr() function issue</title>
      <link>https://community.qlik.com/t5/QlikView/Indirect-set-analysis-calculated-dimension-aggr-function-issue/m-p/849940#M298157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got the solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;added max() function to the aggr() function in market share expression as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({1&amp;lt;Commodity = p(Commodity),QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend)&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Max({1&amp;lt;Commodity = p(Commodity)&amp;gt;}&lt;/STRONG&gt; aggr( NODISTINCT Sum({1&amp;lt;Commodity = p(Commodity), QuarterYear={$(vCurrentQuarter), $(vLastQuarter1), $(vLastQuarter2), $(vLastQuarter3)}&amp;gt;}Spend),Commodity))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 08:49:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Indirect-set-analysis-calculated-dimension-aggr-function-issue/m-p/849940#M298157</guid>
      <dc:creator>kkkumar82</dc:creator>
      <dc:date>2015-04-09T08:49:36Z</dc:date>
    </item>
  </channel>
</rss>

