<?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 Strange behaviour when using aggr within sum function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116716#M887923</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have below expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum(&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp; Aggr(&amp;nbsp; &lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; if(&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order) &amp;gt; 1&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Interval(Max(Basic_Start_Date) - Min({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Actual_Start_Date), 'h')&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; ) / Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; if (&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order) = 0&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; , Interval(Max(Basic_Start_Date) - Min(Basic_Start_Date), 'h')&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; , Interval(Max(Basic_Start_Date) - Min(Basic_Start_Date), 'h') / 2&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; , [Equipment]&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;/ Count({$&amp;lt;[Order Type] = {'A'}, [Equipment]={"=Len(Trim([Equipment]))&amp;gt;0"}&amp;gt;} DISTINCT [Equipment])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each equipment I perfom a calculation (Aggr) and then using Sum function I obtain the summation of all equipments results. Finally I divide this summation by the number of equipments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I see is that it seems like Sum is dividing automatically by the number of equipments once summation is done so at the end the result is divided twice by the number of equipments (that done by Sum "automatically" and that done using the final Count). Could anyone confirm me this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Using interval I obtain the difference between two dates in hours.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Strange behaviour when using aggr within sum function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116716#M887923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have below expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum(&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp; Aggr(&amp;nbsp; &lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; if(&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order) &amp;gt; 1&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Interval(Max(Basic_Start_Date) - Min({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Actual_Start_Date), 'h')&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; ) / Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; if (&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order) = 0&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; , Interval(Max(Basic_Start_Date) - Min(Basic_Start_Date), 'h')&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; , Interval(Max(Basic_Start_Date) - Min(Basic_Start_Date), 'h') / 2&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp; , [Equipment]&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;/ Count({$&amp;lt;[Order Type] = {'A'}, [Equipment]={"=Len(Trim([Equipment]))&amp;gt;0"}&amp;gt;} DISTINCT [Equipment])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each equipment I perfom a calculation (Aggr) and then using Sum function I obtain the summation of all equipments results. Finally I divide this summation by the number of equipments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I see is that it seems like Sum is dividing automatically by the number of equipments once summation is done so at the end the result is divided twice by the number of equipments (that done by Sum "automatically" and that done using the final Count). Could anyone confirm me this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Using interval I obtain the difference between two dates in hours.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116716#M887923</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour when using aggr within sum function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116717#M887924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Tony TP wrote:&lt;/P&gt;
&lt;P&gt;What I see is that it seems like Sum is dividing automatically by the number of equipments once summation is done so at the end the result is divided twice by the number of equipments (that done by Sum "automatically" and that done using the final Count). Could anyone confirm me this?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Not sure I understand this, can you elaborate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2016 19:33:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116717#M887924</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-30T19:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour when using aggr within sum function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116718#M887925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I mean that it seems like Sum is doing the average, that is, it is dividing the result returned by Aggr function by the number of Equipments. But I do not want this because I do this using the last sentence:&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;Count({$&amp;lt;[Order Type] = {'A'}, [Equipment]={"=Len(Trim([Equipment]))&amp;gt;0"}&amp;gt;} DISTINCT [Equipment])&lt;/SPAN&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;BR /&gt;&lt;/SPAN&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;So I would like to know if Sum function does the average automatically when used in combination with Aggr. This is what I have observed but I do not know why Sum function behaves in this way.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2016 21:52:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116718#M887925</guid>
      <dc:creator />
      <dc:date>2016-08-30T21:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour when using aggr within sum function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116719#M887926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see you are some doing some divisions with count (not the count of Equipments), could that be the reason?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=Sum(&lt;/P&gt;&lt;P style="padding: 0 0 0 60px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Aggr(&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; if(&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order) &amp;gt; 1&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; (&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Interval(Max(Basic_Start_Date) - Min({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Actual_Start_Date), 'h')&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ) / &lt;STRONG style="color: #ff0000;"&gt;Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; ,&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; if (&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; Count({$&amp;lt;[Order Type] = {'A'},Actual_Start_Date={'&amp;gt;=$(=Min(Basic_Start_Date))&amp;lt;=$(=Max(Basic_Start_Date))'}&amp;gt;} Order) = 0&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; , Interval(Max(Basic_Start_Date) - Min(Basic_Start_Date), 'h')&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; , Interval(Max(Basic_Start_Date) - Min(Basic_Start_Date), 'h') &lt;STRONG&gt;/ &lt;SPAN style="color: #ff0000;"&gt;2&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P style="padding: 0 0 0 90px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; , [Equipment]&lt;/P&gt;&lt;P style="padding: 0 0 0 60px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp; )&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;/ Count({$&amp;lt;[Order Type] = {'A'}, [Equipment]={"=Len(Trim([Equipment]))&amp;gt;0"}&amp;gt;} DISTINCT [Equipment])&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Could that be causing issues? I don't know how these expressions work, so may be create a straight table to create an expression and break them into pieces and see which part isn't working the way you would expect&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2016 21:59:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-when-using-aggr-within-sum-function/m-p/1116719#M887926</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-30T21:59:33Z</dc:date>
    </item>
  </channel>
</rss>

