<?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: Average calculation based on Max value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514470#M436839</link>
    <description>&lt;P&gt;Yes I know that would help, but what I am looking for is an option to not to add dimensions into the formula as I might add more later, such as Month, Quarter or anything else.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I am looking for solution that use formula and the calculation is adjusted based on dimension on the chart:&lt;/P&gt;&lt;P&gt;For example I have a Bar chart with Year and Quarter&amp;nbsp;as alternative dimension and the results should be reflected based on chosen dimension.&lt;/P&gt;&lt;P&gt;Hope it make sense.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Nov 2018 18:24:31 GMT</pubDate>
    <dc:creator>deniscamh</dc:creator>
    <dc:date>2018-11-29T18:24:31Z</dc:date>
    <item>
      <title>Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514429#M436833</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;My data looks like this:&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Employee, Date, Date_Hired, Year,Years_Of_Service&lt;/P&gt;&lt;P&gt;1,4/30/2017,4/18/2016, 2017,1.032&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1,5/&lt;/SPAN&gt;&lt;SPAN&gt;30&lt;/SPAN&gt;&lt;SPAN&gt;/2017,&lt;/SPAN&gt;&lt;SPAN&gt;4/18/2016, 2017,1.14&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2,4/30/2017,7/25/2011, 2017,5.77&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2,5/&lt;/SPAN&gt;&lt;SPAN&gt;30&lt;/SPAN&gt;&lt;SPAN&gt;/2017,7/25/2011&lt;/SPAN&gt;&lt;SPAN&gt;, 2017,5.84];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I am trying to create is a chart with time frames&amp;nbsp;- Years, Quarter, Month,&amp;nbsp;which calculates average&amp;nbsp;Years_Of_Service per employee. So for year 2017 the calculation will be (1.14 + 5.84)/2.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried something like this: AVG(Agr(Max(Years_Of_Service),Employee)) but it does not work properly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know I am missing something small but cannot figure&amp;nbsp;it out.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Denis&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514429#M436833</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T17:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514432#M436834</link>
      <description>&lt;P&gt;When you say it doesn't work, do you mean it gives null or no value? May be you need to add another g to Aggr() function name&lt;/P&gt;&lt;PRE&gt;Avg(A&lt;FONT color="#FF0000"&gt;g&lt;/FONT&gt;gr(Max(Years_Of_Service), Employee))&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:13:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514432#M436834</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T17:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514435#M436835</link>
      <description>&lt;P&gt;It Gives wrong result.&lt;/P&gt;&lt;P&gt;I do have Aggr correct on my formula.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:17:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514435#M436835</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T17:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514439#M436836</link>
      <description>&lt;P&gt;You are not getting 3.49? Strange, but I am&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/1302i346D6EC7A4DA9A6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 17:21:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514439#M436836</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T17:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514463#M436837</link>
      <description>&lt;P&gt;Try to add years and you will see it does not work and create table wit Year as dimension and&amp;nbsp;measure&lt;/P&gt;&lt;P&gt;AVG(Aggr(Max(Years_Of_Service),Employee))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Employee, Date, Date_Hired, Year,Years_Of_Service&lt;/P&gt;&lt;P&gt;1,4/30/2017,4/18/2016, 2017,1.032&lt;/P&gt;&lt;P&gt;1,5/30/2017,4/18/2016, 2017,1.14&lt;/P&gt;&lt;P&gt;1,5/30/2018,4/18/2016, 2018,2.2&lt;/P&gt;&lt;P&gt;2,4/30/2017,7/25/2011, 2017,5.77&lt;/P&gt;&lt;P&gt;2,5/30/2017,7/25/2011, 2017,5.84&lt;BR /&gt;2,4/1/2018,7/25/2011, 2018,6.69];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:05:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514463#M436837</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T18:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514468#M436838</link>
      <description>&lt;P&gt;Well if year is your chart dimension, you would need that in your Aggr() function as well&lt;/P&gt;&lt;PRE&gt;Avg(Aggr(Max(Years_Of_Service), Employee, Year))&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 781px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/1307i3CE3515130933F29/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:17:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514468#M436838</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T18:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514470#M436839</link>
      <description>&lt;P&gt;Yes I know that would help, but what I am looking for is an option to not to add dimensions into the formula as I might add more later, such as Month, Quarter or anything else.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I am looking for solution that use formula and the calculation is adjusted based on dimension on the chart:&lt;/P&gt;&lt;P&gt;For example I have a Bar chart with Year and Quarter&amp;nbsp;as alternative dimension and the results should be reflected based on chosen dimension.&lt;/P&gt;&lt;P&gt;Hope it make sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:24:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514470#M436839</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T18:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514474#M436840</link>
      <description>&lt;P&gt;Well for your first part... I think if you are adding dimension to you table, then why not just add it to the expression at the same time... I don't think you can get around that....&lt;/P&gt;&lt;P&gt;But for your second issue (alternate dimension... this seems to be in Qlik Sense) you can try this expression&lt;/P&gt;&lt;PRE&gt;Avg(Aggr(Max(Years_Of_Service), Employee, $(='[' &amp;amp; GetObjectDimension() &amp;amp; ']')))&lt;/PRE&gt;&lt;P&gt;GetObjectDimension() will pick the dimension you are on based on the alternate dimension you are on.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:40:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514474#M436840</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T18:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514475#M436841</link>
      <description>&lt;P&gt;Yes I just realized I posted it under Qlikview but I am actually using Sense.&lt;/P&gt;&lt;P&gt;Anyway this applies on both product.&lt;/P&gt;&lt;P&gt;So I tried to create a pivot table with Year and Quarter as dimensions and the measure as below:&lt;/P&gt;&lt;PRE&gt;Avg(Aggr(Max(Years_Of_Service), Employee, Year, Quarter)))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;So it gives correct result for Quarters but not for Year. So I guess the only option is build it with&amp;nbsp;SecondaryDimensionality?&lt;/P&gt;&lt;P&gt;Also the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$(='[' &amp;amp; GetObjectDimension() &amp;amp; ']'&lt;BR /&gt;did not work.&lt;BR /&gt;Thanks&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:57:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514475#M436841</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T18:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514478#M436842</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/21317"&gt;@deniscamh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$(='[' &amp;amp; GetObjectDimension() &amp;amp; ']'&lt;BR /&gt;did not work.&lt;BR /&gt;Thanks&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You tried this in the pivot table or bar chart? GetObjectDimension() is used for alternate dimensions... did you have alternate dimensions in pivot table?&lt;/P&gt;&lt;P&gt;I guess you are not very clear with what you want? Are you not really sure what you want or do you have multiple things you want to accomplish and we are trying to solve 10 different things all at once?&lt;/P&gt;&lt;P&gt;1) GetObjectDimension() seems to work for me&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 935px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/1309i6C547849BE7DFF5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;Had to change the data to this&lt;/P&gt;&lt;PRE&gt;LOAD *,
	 'Q' &amp;amp; Ceil(Month(Date)/3) &amp;amp; '-' &amp;amp; Year as QuarterYear;
LOAD * INLINE [
    Employee, Date, Date_Hired, Year, Years_Of_Service
    1, 4/30/2017, 4/18/2016, 2017, 1.032
    1, 5/30/2017, 4/18/2016, 2017, 1.14
    1, 9/30/2018, 4/18/2016, 2018, 2.2
    2, 4/30/2017, 7/25/2011, 2017, 5.77
    2, 5/30/2017, 7/25/2011, 2017, 5.84
    2, 1/1/2018, 7/25/2011, 2018, 6.69
];&lt;/PRE&gt;&lt;P&gt;2) You are right, the pivot table might require Dimensionality()/SecondaryDimensionality() based on how the pivot table is set up.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514478#M436842</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T19:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514482#M436843</link>
      <description>&lt;P&gt;Yes I tired the&amp;nbsp;$(='[' &amp;amp; GetObjectDimension() &amp;amp; ']' on Bar chart, thank you for clarifying. But it does not work. I will try to play with it later.&lt;/P&gt;&lt;P&gt;Regarding to the&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;Dimensionality I was hoping to avoid that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks anyway.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:10:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514482#M436843</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T19:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514485#M436844</link>
      <description>&lt;P&gt;Oh, you know what... GetObjectDimension() was recently added to Qlik Sense. Are you using an older version of Qlik Sense? Older than September 2017?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.axisgroup.com/data-industry-insights-blog/qlik-sense-september-2017-november-2017-releases" target="_blank"&gt;Qlik Sense September 2017 November 2017 Releases&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:14:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514485#M436844</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T19:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514487#M436845</link>
      <description>&lt;P&gt;No I am using Sep 2018 version now.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514487#M436845</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T19:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514490#M436846</link>
      <description>No idea my friend. I wish I had the option to post the qvf where it is working for me.</description>
      <pubDate>Thu, 29 Nov 2018 19:26:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514490#M436846</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T19:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514492#M436847</link>
      <description>&lt;P&gt;That is ok I will try to figure out.&lt;/P&gt;&lt;P&gt;may be I am doing something wrong.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:29:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514492#M436847</guid>
      <dc:creator>deniscamh</dc:creator>
      <dc:date>2018-11-29T19:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation based on Max value</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514494#M436848</link>
      <description>Sounds good. All the best for your project!!</description>
      <pubDate>Thu, 29 Nov 2018 19:35:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-based-on-Max-value/m-p/1514494#M436848</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-11-29T19:35:39Z</dc:date>
    </item>
  </channel>
</rss>

