<?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 not correct in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470992#M175918</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response as wel...&lt;/P&gt;&lt;P&gt;I did what you suggested: &lt;/P&gt;&lt;P&gt;- I added Reserveringnummer as reserveringnummerausreserveringartikel&amp;nbsp; in table reserveringartikel&lt;/P&gt;&lt;P&gt;- I reloaded and tested this expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif; background-color: #ffffff;"&gt;=avg(aggr(sum(Prijs),reserveringnummerausreserveringartikel))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It still returns the (incorrect) value (1.111,381). See also attached (I added it in red (upper right corner)). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw: I did try a similar thing myself, but then I added that field in the Reservering-table... No luck either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may be "normal behavior", but in the solution you suggest, Qlikview can get its info from the "reserveringartikel table" only. &lt;/P&gt;&lt;P&gt;For me it doesn't really make sense, but I get the idea...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Nov 2012 15:49:16 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-11-27T15:49:16Z</dc:date>
    <item>
      <title>Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470986#M175912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlikview developers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some help to see what is going one here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a pretty simple datamodel (to isolate the problem) and a .qvw in which I try to explain what I think is very strange... I hope someone of you can explain me what is going on...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my case&lt;/P&gt;&lt;P&gt;- I have Bookings and articles (1 - N)&lt;/P&gt;&lt;P&gt;- I want to show in a gauge (or textbox for this purpose) the average total price per booking&lt;/P&gt;&lt;P&gt;- when I calculate this with avg(aggr(sum(Prijs),Reserveringnummer)) this gives another outcome than Sum(Prijs) / count(distinct Reserveringnummer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't explain that, since in this case it should produce the same outcome in my qvw (all articles belong to 1 reservering)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It becomes even stranger: when I do not load my master-calendar... the avg(aggr(sum(Prijs),Reserveringnummer))&amp;nbsp; expression _suddenly_ does give the right result...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope someone can show me what I'm overlooking (or can confirm that this seems to be a bug?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope my attached QVW is clear enough. Let me know if there are any further questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 12:04:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470986#M175912</guid>
      <dc:creator />
      <dc:date>2012-11-27T12:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470987#M175913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's a null value somewhere because of the join. If you change the expression to =avg(aggr(sum({&amp;lt;Prijs={'*'}&amp;gt;} Prijs),Reserveringnummer)) the average is what you expect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 12:16:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470987#M175913</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-11-27T12:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470988#M175914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply... I agree that your expression does produce the correct result... But my first answer was like yours (somewhere there is a nullvalue). I however cannot find where that nullvalue should be... (after looking for it for quite some time).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked this in my datamodel&lt;/P&gt;&lt;P&gt;- Prijs is never "null" or 0&lt;/P&gt;&lt;P&gt;- there are no article (/reserveringartikel) records that do not belong to a reservering record...&amp;nbsp; (there are exactly 54 article lines... and 20 reservering lines and they are referential integer... (no orphans)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So &lt;/P&gt;&lt;P&gt;Question 1: do you have any idea where this null-value comes from in this example?&lt;/P&gt;&lt;P&gt;Question 2: what has my master calendar to do with that expression? In my opinion it is totaly unrelated...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 12:22:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470988#M175914</guid>
      <dc:creator />
      <dc:date>2012-11-27T12:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470989#M175915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your Calendar contains far more dates than there are dates in Reserveringen. That means if the two tables are joined you'll have a lot of nulls for the fields from Reserveringen. Those nulls are aggregated too. So there are 21 aggregations for Reserveringnummer while count(distinct Reserveringnummer) has 20 as result since count doesn't count nulls. Tricky, isn't it &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 12:34:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470989#M175915</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-11-27T12:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470990#M175916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, Thanks for your explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be honest, I find this quite silly behavior.&lt;/P&gt;&lt;P&gt;- I'm aggregating over the field "reserveringnummer" and then expect only a value (sum(Prijs) )for each reserveringnummer that exists in the datamodel. For this calculation (IMO) the calendar object does not have to be joined at all. It should only work as a "filter" of reservering-records (...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I learned this about the aggr that it works like this:&lt;/P&gt;&lt;P&gt;- the first argument is like the expression in your straight table &lt;/P&gt;&lt;P&gt;- all following arguments is like the dimensions in your straight table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in my case I could create a straight table with dimension Reserveringnummer and sum(Prijs) as expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I make this, I only see 20 lines (and not 21). And therefore I'm expecting the avg( ) function to produce the result for 20 records...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words: I can now understand (technically) a bit better what is happening, but stil find this strange behavior. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help anyway &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 12:45:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470990#M175916</guid>
      <dc:creator />
      <dc:date>2012-11-27T12:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470991#M175917</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;It's normal behaviour.&lt;/P&gt;&lt;P&gt;The matter is that "reserveringnummer" is a key field.&lt;/P&gt;&lt;P&gt;Since QV stores the data in a columns the relational structure that you see is virtual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want a solution, just add &lt;/P&gt;&lt;P&gt;"reserveringnummer" as "reserveringnummerausreserveringartikel" &lt;/P&gt;&lt;P&gt;field when you load reserveringartikel table.&lt;/P&gt;&lt;P&gt;So that you could easily use it in aggr() expressions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 13:50:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470991#M175917</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-11-27T13:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470992#M175918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Whiteline,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response as wel...&lt;/P&gt;&lt;P&gt;I did what you suggested: &lt;/P&gt;&lt;P&gt;- I added Reserveringnummer as reserveringnummerausreserveringartikel&amp;nbsp; in table reserveringartikel&lt;/P&gt;&lt;P&gt;- I reloaded and tested this expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif; background-color: #ffffff;"&gt;=avg(aggr(sum(Prijs),reserveringnummerausreserveringartikel))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It still returns the (incorrect) value (1.111,381). See also attached (I added it in red (upper right corner)). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Btw: I did try a similar thing myself, but then I added that field in the Reservering-table... No luck either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may be "normal behavior", but in the solution you suggest, Qlikview can get its info from the "reserveringartikel table" only. &lt;/P&gt;&lt;P&gt;For me it doesn't really make sense, but I get the idea...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 15:49:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470992#M175918</guid>
      <dc:creator />
      <dc:date>2012-11-27T15:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470993#M175919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't noticed that you have duplicates in reserveringartikel table.&lt;/P&gt;&lt;P&gt;See the screen below.&lt;/P&gt;&lt;P&gt;I guess it's obvious that Sum/Count &amp;lt;&amp;gt; Avg in this case.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:22:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470993#M175919</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-11-27T16:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470994#M175920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmz,my statement was that Avg() should be the same as count(&lt;STRONG&gt;distinct &lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still find the avg(aggr()) construction far from intuitive, since from your screenshot I would argue that the 23.339 should be divided by 20 (20 distinct "Reservingnummer") and not by 21 (due to some strange nullvalue).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now know that I have to deal with it, but I hoped there was a good explanation for it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:30:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470994#M175920</guid>
      <dc:creator />
      <dc:date>2012-11-27T16:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470995#M175921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see...&lt;/P&gt;&lt;P&gt;It's even more strange.&lt;/P&gt;&lt;P&gt;In a chart the total is calculated correctly while in a text box its wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 16:58:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470995#M175921</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-11-27T16:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470996#M175922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hehe thanks for sharing this finding.&lt;/P&gt;&lt;P&gt;Strange indeed (...).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 17:56:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470996#M175922</guid>
      <dc:creator />
      <dc:date>2012-11-27T17:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470997#M175923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you create the chart mentioned above and uncheck 'Supress Zero-values' and 'Suppress missing' you'll see that 'strange null' row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;upd:&lt;/P&gt;&lt;P&gt;Also it's something strange with %Datum key field. The screen is attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 19:16:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470997#M175923</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-11-27T19:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470998#M175924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Indeed seems strange (the %Date field in your screenshot), although I don't seem to do very special things...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the attached QVW I made the table you suggested. The strange thing that I now discovered is that&lt;/P&gt;&lt;P&gt;- the expression total is "correct"&lt;/P&gt;&lt;P&gt;- the caption of this chart is incorrect&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;The caption and the total are both derived from one and the same expression...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the .qvw and the screenshot attached to this post.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;whiteline wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you create the chart mentioned above and uncheck 'Supress Zero-values' and 'Suppress missing' you'll see that 'strange null' row.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sorry, I tried to make this "strange null row" visible, but I couldn't. As visible attached, those 2 checkboxes are unchecked (dimensions tab). What else should I do to make that one visible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 20:09:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470998#M175924</guid>
      <dc:creator />
      <dc:date>2012-11-27T20:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470999#M175925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The checkboxes on presentation tab are checked.&lt;/P&gt;&lt;P&gt;Uncheck them (See the screenshot).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The totals is correct, because these checkboxes filter the data set.&lt;/P&gt;&lt;P&gt;The expression for caption is calculated without that filter, so it includes that null values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 06:36:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/470999#M175925</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-11-28T06:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average calculation not correct</title>
      <link>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/471000#M175926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, now i found them (the right ones). I only knew from suppress null-values from the dimensions tab. Good to know.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 09:09:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-calculation-not-correct/m-p/471000#M175926</guid>
      <dc:creator />
      <dc:date>2012-11-28T09:09:43Z</dc:date>
    </item>
  </channel>
</rss>

