<?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: Unexpected result with Avg() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281843#M401812</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like the records where [Datum sluiting doss.] is null are being included in the average. You don't say how the [Status doss.] field is defined, so its hard to say for sure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try changing the expression for [Doorlooptijd doss.] to produce a null when [Datum sluiting doss.] is null, rather than producing an empty string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Nov 2016 08:18:01 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2016-11-21T08:18:01Z</dc:date>
    <item>
      <title>Unexpected result with Avg()</title>
      <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281841#M401810</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 the following bit of code in my load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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;IsNull&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Datum sluiting doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;lt;&amp;gt;-1, &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;// Datum sluiting gevuld? Dan kan doorlooptijd worden gemeten. &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;floor&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Datum sluiting doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) - &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;floor&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Datum melding]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;BR /&gt; '') &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Doorlooptijd doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which checks for a dossier closing date to be filled. If so, it calculates the handling time of the dossier in the field [Doorlooptijd doss.]&lt;/P&gt;&lt;P&gt;In the designer I use this expression to calculate average handling time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;avg&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;BR /&gt; {$&lt;BR /&gt; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Status doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'Gesloten'}&amp;gt;&lt;BR /&gt; }&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Doorlooptijd doss.]&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;As a result (on three closed dossiers) I get 0.3, while I expected 2.0&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/144371_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that [Status doss] = 'Gesloten' is the indicator of [Datum sluiting doss.] to be filled...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 08:04:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281841#M401810</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-11-21T08:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected result with Avg()</title>
      <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281842#M401811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hans,&lt;/P&gt;&lt;P&gt;I'll think you will need to use aggr here, try this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;avg&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(aggr(avg( {$ &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Status doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'Gesloten'}&amp;gt; }&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Doorlooptijd doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),[Datum registr.)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Maybe some more Dimension in Your aggr.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 08:16:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281842#M401811</guid>
      <dc:creator>stabben23</dc:creator>
      <dc:date>2016-11-21T08:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected result with Avg()</title>
      <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281843#M401812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like the records where [Datum sluiting doss.] is null are being included in the average. You don't say how the [Status doss.] field is defined, so its hard to say for sure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try changing the expression for [Doorlooptijd doss.] to produce a null when [Datum sluiting doss.] is null, rather than producing an empty string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 08:18:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281843#M401812</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2016-11-21T08:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected result with Avg()</title>
      <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281844#M401813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I tried your solution; it changed the outcome from 0.3 to 0.5, so still no luck... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;avg&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&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;avg&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;( {$ &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Status doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {'Gesloten'}&amp;gt; }&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Doorlooptijd doss.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Datum registr.]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 08:53:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281844#M401813</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-11-21T08:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected result with Avg()</title>
      <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281845#M401814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Status doss.] contains the status of the dossier, and can be 'Gesloten' (Closed), 'Lopend' (Open) and a few more.&lt;/P&gt;&lt;P&gt;[Datum sluiting doss.]&amp;nbsp; is the date on which the dossier was closed. [Datum melding] = report date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to change the outcome of the doorlooptijd expression to null(), but to no avail...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 08:58:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281845#M401814</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-11-21T08:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected result with Avg()</title>
      <link>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281846#M401815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have found the answer. For some stupid reason, zero values were suppressed in my straight table... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 09:15:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unexpected-result-with-Avg/m-p/1281846#M401815</guid>
      <dc:creator>hansdevr</dc:creator>
      <dc:date>2016-11-21T09:15:13Z</dc:date>
    </item>
  </channel>
</rss>

