<?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: Include missing data when calculating average (etc) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Include-missing-data-when-calculating-average-etc/m-p/680560#M1074269</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This has been answered here: &lt;A href="https://community.qlik.com/message/584687"&gt;Re: Re: Why does my Avg expression not work (I mean how do I get it to work)&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Aug 2014 14:47:18 GMT</pubDate>
    <dc:creator>lawrenceiow</dc:creator>
    <dc:date>2014-08-07T14:47:18Z</dc:date>
    <item>
      <title>Include missing data when calculating average (etc)</title>
      <link>https://community.qlik.com/t5/QlikView/Include-missing-data-when-calculating-average-etc/m-p/680559#M1074268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, so now that I've typed the title for my question it looks a little odd - including something that doesn't exist in a calculation.&lt;/P&gt;&lt;P&gt;But, as &lt;A href="https://community.qlik.com/qlik-users/4003"&gt;Henric Cronström&lt;/A&gt; said in his article &lt;A href="https://community.qlik.com/qlik-blogpost/2650"&gt;The Importance of Nothing&lt;/A&gt; "Few things are as important to understand as the concept of nothingness". So, thanks to these articles, I know Qlikview can do it, I'm just struggling to get my head around how to correctly write the expression(s) - so far my various attempts have failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In brief, I need to get an average over a period of time and on some days there is no data and therefore should be counted as zero for that date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Coming to Qlikview as an Excel user I just need to figure out how to do in Qlikview the stuff I already have learnt how to do in Excel. So, attached is an Excel mock up of a dataset that I need to create a chart for. In the spreadsheet columns A &amp;amp; B contain the data that I will load into my Qlikview fact table. Columns J and K show three values that I need adding to my Qlikview chart as reference lines. I've got this working (see attached qvw) fine until I select 'N' in the "Like" field - this is where I need to know how to get Qlikview to give me the results as shown in the Excel file. At the moment it does not and I assume that this is because the avg and stdev are not including the days, in the denominator, where there aren't any "N" values. Hopefully someone can explain the correct way in simple terms for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In very basic terms I have the follow results from a dataset (dataset has two fields: Date and Response. Response contains either "Like" or "Dislike"&amp;nbsp; see attached 004.qvw):&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; WIDTH: 100%; BORDER-TOP: #000000 1px solid; BORDER-RIGHT: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Like&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Dislike&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;14/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;15/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;16/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;17/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#000000&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#ffffff&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690bc&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #ffffff; font-family: Arial; color: #ffffff; vertical-align: baseline; padding: 2px;"&gt;&lt;STRONG&gt;Header 1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #ffffff; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Header 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;The StDev for Like is 0.5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;=&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Stdev&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;Count&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;Response&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;The Average for Like is 2.25&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;=&lt;SPAN style="font-size: 8pt;"&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;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Response&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Giving an Upper of 3.25&amp;nbsp; (Avg + 2 x StDev)&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;=(&lt;SPAN style="color: #3366ff;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Avg(aggr(Count(Response),Date&lt;SPAN style="color: #000000;"&gt;)))+2*(&lt;/SPAN&gt;Stdev(aggr(Count&lt;/SPAN&gt;(&lt;SPAN style="color: #993300;"&gt;Response&lt;/SPAN&gt;) ,&lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;and a Lower of 1.25&amp;nbsp; (Avg - 2 x StDev)&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=RangeMax(0,(&lt;SPAN style="color: #3366ff;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Avg(aggr(Count(Response),Date&lt;SPAN style="color: #000000;"&gt;)))-2*(&lt;/SPAN&gt;Stdev(aggr(Count&lt;/SPAN&gt;(&lt;SPAN style="color: #993300;"&gt;Response&lt;/SPAN&gt;) ,&lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;&lt;/SPAN&gt;))))&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QlikView is giving me the correct answers for Like but incorrect answers for Dislike and I presume this is because there are only two records with a Dislike - one on 14th and one on 17th. What's the correct syntax I should be using.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2014 10:41:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Include-missing-data-when-calculating-average-etc/m-p/680559#M1074268</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-07-30T10:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Include missing data when calculating average (etc)</title>
      <link>https://community.qlik.com/t5/QlikView/Include-missing-data-when-calculating-average-etc/m-p/680560#M1074269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This has been answered here: &lt;A href="https://community.qlik.com/message/584687"&gt;Re: Re: Why does my Avg expression not work (I mean how do I get it to work)&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 14:47:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Include-missing-data-when-calculating-average-etc/m-p/680560#M1074269</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-07T14:47:18Z</dc:date>
    </item>
  </channel>
</rss>

