<?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: Why does my Avg expression not work (I mean how do I get it to work) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728335#M1072102</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, thanks for the advice Evan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Aug 2014 13:51:23 GMT</pubDate>
    <dc:creator>lawrenceiow</dc:creator>
    <dc:date>2014-08-07T13:51:23Z</dc:date>
    <item>
      <title>Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728320#M1072087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So, I can do this in Excel but can't think how I do it in QlikView, please can someone help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="299" style="width: 332px; height: 299px; border: #000000 1px solid;" width="330"&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;Response&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Quantity&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;Like&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;14/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Like&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;14/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Dislike&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;14/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Like&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;Like&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;Like&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;16/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Like&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;16/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Like&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;17/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Like&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;17/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Like&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;17/01/2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Dislike&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, above I have a simplified version of my data which can be summarised as:&lt;/P&gt;&lt;P&gt;14/01/2014&amp;nbsp; Like = 3, Dislike = 1&lt;/P&gt;&lt;P&gt;15/01/2014&amp;nbsp; Like = 2, Dislike = 0&lt;/P&gt;&lt;P&gt;16/01/2014&amp;nbsp; Like = 2, Dislike = 0&lt;/P&gt;&lt;P&gt;17/01/2014&amp;nbsp; Like = 2, Dislike = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Over the period, I have an average of 2.25 (9/4) likes and 0.5 (2/4) dislikes. What expression should I be using in QlikView because the one I'm using gives me 2.25 When Like is selected in the list box but gives 1 when dislike is selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression : &lt;SPAN style="color: #0000ff;"&gt;Avg&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #993300;"&gt;Quantity&lt;/SPAN&gt;),&lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also need a standard deviation and an upper and lower limit.&amp;nbsp; As I say, the above is a simplified version of my data which has around 80,000 records over two years and a variety of filters than need applying (not just Like or Dislike).&amp;nbsp; I've created the chart and I just need to add reference lines for avg, upper and lower. These were all setup and worked well right up until I started applying filters which resulted in there being no data on some days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Excel has been providing the correct answers for years and I now need to replace the spreadsheet with a QlikView version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I originally posted this question here &lt;A href="https://community.qlik.com/message/578966"&gt;Include missing data when calculating average (etc)&lt;/A&gt; but I probably worded it really badly as no one has been able to help. So, I'm hoping by re-wording it here someone will understand what I'm trying to acheive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lawrence&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 16:12:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728320#M1072087</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-06T16:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728321#M1072088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you want Stanadard Desviation see this disscusion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/523956#523956"&gt;Calculate standard desviation in a pivot table&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;look for Gauss Chart if you need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 16:38:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728321#M1072088</guid>
      <dc:creator />
      <dc:date>2014-08-06T16:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728322#M1072089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used your data to create an example (attached).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Used SET ANALYSIS to come up with % liked / disliked by day &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%&amp;nbsp; Liked:&amp;nbsp; (disregards user selection on like/dislike field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( {$&amp;lt;[Like/Disklike]={'Like'}&amp;gt;}&amp;nbsp; Count)&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;sum( {$&amp;lt;[Like/Disklike]=&amp;gt;} total &amp;lt;Date&amp;gt; Count)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%&amp;nbsp;&amp;nbsp; DisLiked:&amp;nbsp; (disregards user selection on like/dislike field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( {$&amp;lt;[Like/Disklike]={'Dislike'}&amp;gt;}&amp;nbsp; Count)&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt;"&gt;sum( {$&amp;lt;[Like/Disklike]=&amp;gt;} total &amp;lt;Date&amp;gt; Count)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 16:55:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728322#M1072089</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-06T16:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728323#M1072090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply, Oswaldo. I already have an expression for standard deviation, in fact I all the expressions I need and they give me the correct answers BUT, they only give me the correct answers when I have data for all dates. I've shown the expression that I use for the average in the hope that someone will point out what I've done wrong, I can then apply the same principal to my other expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it helps, the expressions I've used are:&lt;/P&gt;&lt;P&gt;=Stdev(aggr(Sum(Qty),Date))&amp;nbsp; for the standard deviation&lt;/P&gt;&lt;P&gt;=(Avg(aggr(sum(Qty),Date)))+2*(Stdev(aggr(sum(Qty),Date)))&amp;nbsp;&amp;nbsp; for the Upper limit&lt;/P&gt;&lt;P&gt;=(RangeMax(0,(Avg(aggr(sum(Qty),Date)))-2*(Stdev(aggr(sum(Qty),Date)))))&amp;nbsp;&amp;nbsp; for the Lower limit (but no lower than 0)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 16:58:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728323#M1072090</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-06T16:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728324#M1072091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply Jonathon and for taking the time to create the qvw file. However, I &lt;EM&gt;do&lt;/EM&gt; need the user to be able to select Like or Dislike so that they can "explore" the data and make "business discoveries".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if you would mind taking a look at &lt;EM&gt;my&lt;/EM&gt; qvw file. I have also attached a simplified version of the Excel file (just in case you are able to see how I do it in Excel).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you will see, I have a chart which I am adding three reference lines to give Average, Upper and Lower (StDev is required for the upper and lower).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To start with (ie with nothing selected) the correct values are shown. Selecting Like again gives the correct answers. However, selecting Dislike does not give the correct answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you are able to take a look at the qvw for me as I'm sure the answer is simple, if only I could explain myself clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lawrence&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 17:26:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728324#M1072091</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-06T17:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728325#M1072092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your problem is that avg() only averages over non-missing values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The response Dislike only exists for 2 dates and therefore you get 2/2 = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this expression in stead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(Quantity)/count({1}distinct Date)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 17:34:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728325#M1072092</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-08-06T17:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728326#M1072093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant! Thanks Simen. I knew what was causing the problem ie "The response Dislike only exists for 2 dates and therefore you get 2/2 = 1" but I didn't know how to fix it. So, now we've got the Avg working by not using Avg, how do we get the StDev working without using StDev???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 17:43:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728326#M1072093</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-06T17:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728327#M1072094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in your example is the correct average for dislike = 1&amp;nbsp; (because on the two dates that has dislikes there was 1 dislike count on each date.... 2/2 = 1)&amp;nbsp; &lt;/P&gt;&lt;P&gt;or is the correct answer 0.5 (because there were 2 dislike counts over 2 days but there were 2 other days with no dislikes&amp;nbsp; ... 2/4 = .5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 17:50:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728327#M1072094</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-06T17:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728328#M1072095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about something like:&lt;/P&gt;&lt;P&gt;sqrt(sum(aggr(pow(sum(Quantity)-sum(total Quantity)/count(total distinct Date),2),Date))/Count(TOTAL DISTINCT Date))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 17:57:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728328#M1072095</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-08-06T17:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728329#M1072096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello lawrenceiow, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like your metric is defined as:&lt;/P&gt;&lt;P&gt;(Sum of Quantity In Selection / Number of TOTAL distinct Dates)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Avg(Aggr()) combination can be tricky, especially with regards to text box usage where sometimes selections in the Aggr field, or the Aggr field being involved in a table join will introduce a Null() slot to the denominator, thereby spreading out the average over values + 1 (similar to the way charts generate a Null dimension).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may have an easier time avoiding Avg(), and using the 2-part calculation (Sum / Count)&lt;BR /&gt;Sum(Quantity) / Count(DISTINCT {&amp;lt;Response&amp;gt;} Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="TEMP_PIC.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/63894_TEMP_PIC.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 21:11:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728329#M1072096</guid>
      <dc:creator>evan_kurowski</dc:creator>
      <dc:date>2014-08-06T21:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728330#M1072097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My denominator will always need to be the number of days in the selected period of time (Year, month, Qtr, Mon-Frid, whatever) irrespective of what other selections are made. The numerator would relate to whatever was selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had &lt;SPAN style="text-decoration: underline;"&gt;hoped&lt;/SPAN&gt; that if I used aggr(sum(Quantity), Date), which I understood to mean "give me the total of Quantity for each Date", then I could also use aggr(sum(Quantity), {&amp;lt;Response=&amp;gt;}Date) to mean "give me the total of Quantity for all dates, ignoring the Response selection". But it would seem that's not valid syntax.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 12:42:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728330#M1072097</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-07T12:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728331#M1072098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you fall asleep on the keyboard? &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/laugh.png" /&gt; Are you sure all those functions are allowed to exist in one expression? &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seriously though, your expression has given me a number. It is a number which is different to the number Excel gives me (notice I have avoided using the word "wrong")..&amp;nbsp; I have a statistican visiting me this afternoon so I will ask him which he thinks is the correct answer - your answer or the Excel answer. Hopefully he will agree with your answer (for all I know you may be a statistician yourself) and I can move on with my dashboard design.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 12:51:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728331#M1072098</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-07T12:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728332#M1072099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hehe, I used this page to test the numbers: &lt;A href="http://easycalculation.com/statistics/standard-deviation.php" title="http://easycalculation.com/statistics/standard-deviation.php"&gt;Standard Deviation Calculator - Calculate mean, variance of the numbers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with the test numbers 3,2,2,2 for like i get a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Population Standard Deviation of 0.43301 which I also get in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What number do you expect?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:02:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728332#M1072099</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-08-07T13:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728333#M1072100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Evan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are right, using your 'long-hand' method has correctly given me the average, thank you. All I need now is the 'long-hand' method for StdDev.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must say, I was rather hoping that I could use the &lt;STRONG&gt;{&amp;lt;Response&amp;gt;}&lt;/STRONG&gt; bit of set analysis against the Date part of Aggr() but it would seem that is not allowed.&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp; &lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;Avg&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;Sum&lt;/SPAN&gt;(&lt;SPAN style="color: #993300;"&gt;Quantity&lt;/SPAN&gt;), {&amp;lt;Response&amp;gt;} &lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:05:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728333#M1072100</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-07T13:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728334#M1072101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, one thing you may want to consider is that the "long-hand" method can sometimes be more consistent for total calculations in objects like Pivot tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At one point or another, collapsing/expanding dimensions, pivoting, and partial sum have all broken my Avg() expressions or totals.&amp;nbsp; Trying to keep the Aggr() dimension arguments in lockstep to the chart dimensions can add complexity (especially if the chart is using dynamic dimensions).&amp;nbsp; Using the sum/count method in my experience has been more sturdy and perhaps prevents some "Avg of the avg" rollup distortions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:34:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728334#M1072101</guid>
      <dc:creator>evan_kurowski</dc:creator>
      <dc:date>2014-08-07T13:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728335#M1072102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, thanks for the advice Evan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 13:51:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728335#M1072102</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-07T13:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728336#M1072103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant yet again Simen!&amp;nbsp; Thank you very much for your help.&lt;/P&gt;&lt;P&gt;Whilst your expression gave a different answer to Excel it is because your expression is calculating StDevP and my Excel formula is StDev. When I change Excel to StDevP it matches yours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I make a selection in my "Response" list box it gives the wrong answer. This is because (using my example) I do not have a "Dislike" response for every date. Following the advice from others I have put a Set Analysis modifier into your expression. This then gives me the correct answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the final answer is....&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff;"&gt;sqrt&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;pow&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #993300;"&gt;Qty&lt;/SPAN&gt;)-&lt;SPAN style="color: #0000ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;total&lt;/SPAN&gt; &lt;SPAN style="color: #993300;"&gt;Qty&lt;/SPAN&gt;)/&lt;SPAN style="color: #0000ff;"&gt;count&lt;/SPAN&gt;(&lt;SPAN style="color: #0000ff;"&gt;total distinct&lt;/SPAN&gt; {&amp;lt;&lt;SPAN style="color: #993300;"&gt;Response&lt;/SPAN&gt;&amp;gt;} &lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;),2),&lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;))/Count(&lt;SPAN style="color: #0000ff;"&gt;TOTAL&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;DISTINCT&lt;/SPAN&gt; &lt;SPAN style="color: #993300;"&gt;Date&lt;/SPAN&gt;)) &lt;/STRONG&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just hope no one else in my office sees the expression in my chart and asks me to explain it! For myself, I'll add a comment wherever I use this to explain it is the "long hand" version of StDevP because, I just know, when I look at this six months down the line I won't remember where it came from or what it does.&lt;/P&gt;&lt;P&gt;Thanks again &lt;A href="https://community.qlik.com/qlik-users/137372"&gt;Simen Kind Gulbrandsen&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 14:37:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728336#M1072103</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-07T14:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728337#M1072104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The above reply was stuck in moderation queue for some hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm glad it worked out. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 19:29:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728337#M1072104</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2014-08-07T19:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my Avg expression not work (I mean how do I get it to work)</title>
      <link>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728338#M1072105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, thanks Simen. I received an email with the post that got "stuck" and, of course, when I clicked the link in the email to "go to the message on Qlik Community" I ended up on a page that stated I was not authorised to view the comment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume the hold up was due to you using a link to a non-QlikView website. That website looks like it might be useful so thanks for that and thank you for all your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lawrence&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2014 07:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-does-my-Avg-expression-not-work-I-mean-how-do-I-get-it-to/m-p/728338#M1072105</guid>
      <dc:creator>lawrenceiow</dc:creator>
      <dc:date>2014-08-08T07:38:47Z</dc:date>
    </item>
  </channel>
</rss>

