<?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: Wrong avg value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048320#M352268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you are looking for the midpoint between Hour 1 and Hour 2. If I am correct, a problem I see with your expression is that avg(Hour 2 - Hour 1) is not the midpoint. The midpoint is (Hour 2 + Hour 1)/2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Time(avg(Aggr(([Hour2] + [Hour1])/2, ID, [Hour1], [Hour2])))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Apr 2016 15:39:01 GMT</pubDate>
    <dc:creator>jlongoria</dc:creator>
    <dc:date>2016-04-04T15:39:01Z</dc:date>
    <item>
      <title>Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048317#M352265</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'm facing a very strange issue. I have this expression: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=(time(avg({&amp;lt; _Type={2}&amp;gt;} [Hour 2]-[Hour 1])))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I get this strange result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="qlik_help.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/120425_qlik_help.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I sum all the values, the result is 21:11:00, so, I am pretty convinced that this avg value is wrong. I don't know what to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, &lt;/P&gt;&lt;P&gt;Ines&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 14:54:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048317#M352265</guid>
      <dc:creator>inescastelhano</dc:creator>
      <dc:date>2016-04-04T14:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048318#M352266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;What about this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG style=": ; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;=&lt;SPAN style="color: #ff0000;"&gt;Time(Avg(Aggr(&lt;/SPAN&gt;(Time(Avg({&amp;lt; _Type={2}&amp;gt;} [Hour 2] - [Hour 1])))&lt;SPAN style="color: #ff0000;"&gt;, ID, [Hour 1], [Hour 2])))&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 14:57:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048318#M352266</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-04-04T14:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048319#M352267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where is your _Type field?&lt;/P&gt;&lt;P&gt;It's hard to compare your excel table screenshot with a calculation without knowing the full background.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And do you want to sum or average the intervals? You are using avg() in the expression but you are referencing a sum both in your manual calculation as well as the chart header.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 15:10:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048319#M352267</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-04-04T15:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048320#M352268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you are looking for the midpoint between Hour 1 and Hour 2. If I am correct, a problem I see with your expression is that avg(Hour 2 - Hour 1) is not the midpoint. The midpoint is (Hour 2 + Hour 1)/2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Time(avg(Aggr(([Hour2] + [Hour1])/2, ID, [Hour1], [Hour2])))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2016 15:39:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048320#M352268</guid>
      <dc:creator>jlongoria</dc:creator>
      <dc:date>2016-04-04T15:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048321#M352269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, I'm not sure that using the Avg() function is the right approach. It may be better to use a sum and divide by a count. See &lt;A href="https://community.qlik.com/qlik-blogpost/3208"&gt;Average – Which average?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further, what you have in the picture is what you have in a QlikView chart. But these numbers are aggregated numbers and not necessarily the same as the numbers in source data. For instance, if your source data is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hour1, Hour2&lt;/P&gt;&lt;P&gt;09:00, 10:00&lt;/P&gt;&lt;P&gt;09:00, 10:00&lt;/P&gt;&lt;P&gt;10:00, 11:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you will have a chart with just two lines (the distinct combinations):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hour1, Hour2, A&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vg(Hour2-Hour1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;09:00, 10:00, 1:00&lt;/P&gt;&lt;P&gt;10:00, 11:00, 1:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 09:01:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048321#M352269</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2016-04-05T09:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048322#M352270</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;What is it exactly you would like to achieve here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 12:18:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048322#M352270</guid>
      <dc:creator />
      <dc:date>2016-04-05T12:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong avg value</title>
      <link>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048323#M352271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I found the reason. Qlik was returning a negative value for the last entry of the table, when converted to number (instead of time). Then, I found out this was &lt;SPAN lang="en"&gt;misrepresenting the avg value. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2016 13:03:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Wrong-avg-value/m-p/1048323#M352271</guid>
      <dc:creator>inescastelhano</dc:creator>
      <dc:date>2016-04-05T13:03:45Z</dc:date>
    </item>
  </channel>
</rss>

