<?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: Aggregation second paramerter dependent on user selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953705#M327896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I "think" I figured out how to make this work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a button to set desired aggregation field using the system field '$Field' and a multi-tiered if statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if((getselectedcount([State Name])+getselectedcount([Sales Manager]))&amp;gt;0,'Sales Rep',IF(getselectedcount([VP Name])&amp;gt;0,'Sales Manager',if(getselectedcount([District Name])&amp;gt;0,'VP Name',District Name')))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm then using [$Field] as my aggregator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, since I don't have developer rights to our QV, I can't use triggers or macros to set variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got two concerns...&lt;/P&gt;&lt;P&gt;- First, the field I'm using is a system field.&amp;nbsp; I don't know how it is used elsewhere within the application, so am concerned about using this as the variable.&amp;nbsp; That said, it works because it already contains all of the field names within the application.&lt;/P&gt;&lt;P&gt;- Second, it requires the user to click on a button.&amp;nbsp; Ideally, I'd refresh the aggregator field whenever the dimension field selections changes.&amp;nbsp; If there's a way to do this without accessing triggers or macros, ideally by variable rather than with the system field, I'd appreciate any suggestions.&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;-Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Nov 2015 16:42:28 GMT</pubDate>
    <dc:creator>phuelish</dc:creator>
    <dc:date>2015-11-09T16:42:28Z</dc:date>
    <item>
      <title>Aggregation second paramerter dependent on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953704#M327895</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'm trying to build an expression for a gauge chart that sets the maximum based on user selections. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user can review the percentage of incomplete sales by [District Name],[VP Name],[State Name],[Sales Manager] and [Sales Representative].&amp;nbsp; The dashboard will have a straight table showing the ranking of whatever the user selects based on the next higher level of the hierarchy.&amp;nbsp; If the user selects a sales representative, it'll show a list of all sales reps with the same sales manager, and where the sales rep ranks within the sales manager's group. I want to dynamically set the gauge max, since there's a wide degree of variance in percentage of incomplete sales between sales managers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an example, The gauge chart will show the result for the selection (i.e. sales rep), with a gauge max based on the highest sales rep.&amp;nbsp; The expression below works great for setting the max if I explicitly name the aggregation second parameter, but doesn't work if I use an if statement to determine the second parameter (Bad Min or Max Value in Gauge):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Working Gauge MAX expression&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;max(AGGR(CEIL(IF(SUM( {$&amp;lt;[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-11))"}&amp;gt;}[Sales])&amp;gt;24,Sum( {$&amp;lt;[Sale_Completion]={0},[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-11))"}&amp;gt;}[Sales])/SUM( {$&amp;lt;[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-11))"}&amp;gt;}[Sales]),0),0.01),[State Name]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried replacing [State Name] with a conditional statement, but haven't had any luck:&lt;/P&gt;&lt;P&gt;if(getselectedcount([Sales Rep])&amp;gt;0,[Sales Rep],[State Name])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the AGGR function allow a dynamic second parameter?&amp;nbsp; If so, how do I fix my expression?&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;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Nov 2015 15:13:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953704#M327895</guid>
      <dc:creator>phuelish</dc:creator>
      <dc:date>2015-11-06T15:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation second paramerter dependent on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953705#M327896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I "think" I figured out how to make this work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a button to set desired aggregation field using the system field '$Field' and a multi-tiered if statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if((getselectedcount([State Name])+getselectedcount([Sales Manager]))&amp;gt;0,'Sales Rep',IF(getselectedcount([VP Name])&amp;gt;0,'Sales Manager',if(getselectedcount([District Name])&amp;gt;0,'VP Name',District Name')))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm then using [$Field] as my aggregator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, since I don't have developer rights to our QV, I can't use triggers or macros to set variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got two concerns...&lt;/P&gt;&lt;P&gt;- First, the field I'm using is a system field.&amp;nbsp; I don't know how it is used elsewhere within the application, so am concerned about using this as the variable.&amp;nbsp; That said, it works because it already contains all of the field names within the application.&lt;/P&gt;&lt;P&gt;- Second, it requires the user to click on a button.&amp;nbsp; Ideally, I'd refresh the aggregator field whenever the dimension field selections changes.&amp;nbsp; If there's a way to do this without accessing triggers or macros, ideally by variable rather than with the system field, I'd appreciate any suggestions.&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;-Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Nov 2015 16:42:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953705#M327896</guid>
      <dc:creator>phuelish</dc:creator>
      <dc:date>2015-11-09T16:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation second paramerter dependent on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953706#M327897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully someone is learning something as a result of my trials-and-errors. The $Field idea didn't work as I expected, so I used the Stefan WALTHER's &lt;A href="http://www.qlikblog.at/tools/Nested-If-Generator.html"&gt;Nested If Statement creator &lt;/A&gt;to develop the following conditional:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(getselectedcount(Sales_Rep)&amp;gt;0,MAX(AGGR(CEIL(IF(SUM( {$&amp;lt;Sales_Rep=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales)&amp;gt;24,Sum( {$&amp;lt;[Product_No]={500,504,770},Sales_Rep=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales )/SUM( {$&amp;lt;Sales_Rep=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales),0),0.01),Sales_Rep)), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(getselectedcount(Sales_Mgr)&amp;gt;0,MAX(AGGR(CEIL(IF(SUM( {$&amp;lt;Sales_Mgr=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales)&amp;gt;24,Sum( {$&amp;lt;Sales_Mgr=,[Product_No]={500,504,770},[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales )/SUM( {$&amp;lt;Sales_Mgr=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales),0),0.01),Sales_Mgr)), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(getselectedcount([VP Name])&amp;gt;0,MAX(AGGR(CEIL(Sum( {$&amp;lt;[VP Name]=,[Product_No]={500,504,770},[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales )/SUM( {$&amp;lt;[VP Name]=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales),0.01),[VP Name])), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(getselectedcount([State Name])&amp;gt;0,MAX(AGGR(CEIL(Sum( {$&amp;lt;[Product_No]={500,504,770},[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"},[State Name]=&amp;gt;}Sales )/SUM( {$&amp;lt;[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"},[State Name]=&amp;gt;}Sales),0.01),[State Name])),MAX(AGGR(CEIL(Sum( {$&amp;lt;[District]=,[Product_No]={500,504,770},[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales )/SUM( {$&amp;lt;[District]=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales),0.01),[District]))))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the max to be set to the highest result for the level of detail selected based on the hierarchical parent. As an example, if I select a sales rep, I want the gauge max to be the highest sales rep working for that sales manager.&amp;nbsp; I thought that removing the criteria within the set analysis would allow me to do this, but not so...I suspect that the aggregation term is causing the calculation to ignore the criteria change.&lt;/P&gt;&lt;P&gt;I'd go with a static max, but the range of results expand quite a bit as it gets more granular, even when limiting the analysis to only sales reps with at least 25 contracts. Any ideas on how to do this would be greatly appreciated, especially if I'm headed for a dead end.&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;-Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2015 22:45:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953706#M327897</guid>
      <dc:creator>phuelish</dc:creator>
      <dc:date>2015-11-10T22:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation second paramerter dependent on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953707#M327898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally! Got it figured out...I removed the selections within Sum aggregation, but I also needed to remove the selections within the Max aggregation...it has to be removed in both places.&amp;nbsp; For simplicity:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MAX(&lt;STRONG&gt;{&amp;lt;[District]=&amp;gt;}&lt;/STRONG&gt; AGGR(CEIL(Sum( {$&amp;lt;[District]=,[Product_No]={500,504,770},[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales )/SUM( {$&amp;lt;[District]=,[Month Name]= {"&amp;gt;=$(=addmonths(monthname(ReloadTime()),-13))"}&amp;gt;}Sales),0.01),[District]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2015 16:17:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-second-paramerter-dependent-on-user-selection/m-p/953707#M327898</guid>
      <dc:creator>phuelish</dc:creator>
      <dc:date>2015-11-11T16:17:28Z</dc:date>
    </item>
  </channel>
</rss>

