<?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: Optimize Aggr() Calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420243#M488678</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way to do it without altering the script?&amp;nbsp; There are millions of rows of data and summing in the script with that many rows takes a very long time (on top of the already outrageous amount of time that it takes to load).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Jan 2013 15:53:51 GMT</pubDate>
    <dc:creator>Nicole-Smith</dc:creator>
    <dc:date>2013-01-14T15:53:51Z</dc:date>
    <item>
      <title>Optimize Aggr() Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420241#M488676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm currently writing a calculation that needs to count the number of Payers that have a Balance greater than 0 for a particular month.&amp;nbsp; The Balance is a sum of everything in the field Balance up to that month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This calculation returns the correct information, but it is much too slow to actually use (the chart takes about 5 minutes to calculate when using this): sum(aggr(if(sum(Balance)&amp;gt;0, 1, 0), Payer, Month))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody know of a faster calculation that I could replace this with?&amp;nbsp; (I am thinking that the slowness is coming from the if statement inside of the aggr() because if I take the if statement out, it runs much faster, but it doesn't return the correct information.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is much appreciated!&amp;nbsp; Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jan 2013 13:58:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420241#M488676</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2013-01-14T13:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Aggr() Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420242#M488677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could add a field in the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;join load &lt;/P&gt;&lt;P&gt;Payer, Month, if(sum(Balance)&amp;gt;0,1,0) as HasPosBal&lt;/P&gt;&lt;P&gt;resident ...fromsomewhere...&lt;/P&gt;&lt;P&gt;group by Payer,Month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and use the field HasPosBal in your expression.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jan 2013 14:20:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420242#M488677</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-01-14T14:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Aggr() Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420243#M488678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way to do it without altering the script?&amp;nbsp; There are millions of rows of data and summing in the script with that many rows takes a very long time (on top of the already outrageous amount of time that it takes to load).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jan 2013 15:53:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420243#M488678</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2013-01-14T15:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Aggr() Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420244#M488679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think so. You can either take your performance hit in the script or in your charts. Maybe you can find some tips in &lt;A _jive_internal="true" href="https://community.qlik.com/thread/18473"&gt;this thread&lt;/A&gt;. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Jan 2013 17:22:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420244#M488679</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-01-14T17:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Aggr() Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420245#M488680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;‌Nicole,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By coincidence I stumbled upon your several years old post. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might have a solution for you. Try:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: '.SFUIText'; font-size: 17pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: '.SFUIText'; font-size: 17pt;"&gt;sum(aggr(floor((sign(sum(Balance))+1)/2), Payer, Month))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a way around time consuming if statements, and should be much faster. Sign() returns 1 for positive balance, 0 for 0 balance and -1 for negative balances. by adding one and dividing by two, negative lances become 0, zero balances become 0.5 and our desired positive balances become 1. Floor() cuts the decimal, so the zero balances also return 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are left with 1 for each positive balance; The same result without the IF statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Aug 2017 07:12:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420245#M488680</guid>
      <dc:creator>Christian_Lauritzen</dc:creator>
      <dc:date>2017-08-13T07:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Aggr() Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420246#M488681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe you can create a Key field by having Prayer and Month together (Prayer&amp;amp;Month)&amp;nbsp; and&amp;nbsp; use that in&amp;nbsp; set analysis like the below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {&amp;lt;Key={"=sum(Balance)&amp;gt;0"}&amp;gt;} 1)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2017 05:03:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Optimize-Aggr-Calculation/m-p/420246#M488681</guid>
      <dc:creator>qliksus</dc:creator>
      <dc:date>2017-08-15T05:03:01Z</dc:date>
    </item>
  </channel>
</rss>

