<?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 Help! use Aggregation function or use Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253535#M96072</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could consider replacing the count(distinct trip_id) with a sum. Please refer to the manual, if I remember correctly chapter C.2 of book III, "Application Performance Optimization - Count (Distinct 'FieldName')", for some methods to do this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Feb 2012 22:00:12 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2012-02-03T22:00:12Z</dc:date>
    <item>
      <title>Help! use Aggregation function or use Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253534#M96071</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;I need to create a weekly trend chart to analyze the % of trips by week where 1/2/3/4/5/6+ units got purchased. But because our data volume is large, the performance is very bad. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any recomendations? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(denominator is the total trips where units purchased &amp;gt; 0, nominator is the number of trips where units purchased =1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is my expression using&lt;STRONG&gt; aggr functions &lt;/STRONG&gt;for % of trips where units purchased = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;count(distinct if( aggr(Sum ({&amp;lt;yr_wk = {'&amp;gt;=$(=vMinWK)&amp;lt;=$(=vMaxWK)'}&amp;gt;} quantity), trip_id)=1, trip_id))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;count(distinct if(aggr(Sum ({&amp;lt;yr_wk = {'&amp;gt;=$(=vMinWK)&amp;lt;=$(=vMaxWK)'}&amp;gt;} quantity), trip_id)&amp;gt;0, trip_id))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is my expression using &lt;STRONG&gt;set analysis &lt;/STRONG&gt;for % of trips where units purchased = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;count({&amp;lt;&lt;SPAN style="color: #0000ff;"&gt;trip_id&lt;/SPAN&gt;= {"=Sum({&amp;lt;yr_wk = {'&amp;gt;=$(=&lt;SPAN style="color: #0000ff;"&gt;vMinWK&lt;/SPAN&gt;)&amp;lt;=$(=&lt;SPAN style="color: #0000ff;"&gt;vMaxWK&lt;/SPAN&gt;)'}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;quantity&lt;/SPAN&gt;)=1"}&amp;gt;} distinct &lt;SPAN style="color: #0000ff;"&gt;trip_id&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;count({&amp;lt;&lt;SPAN style="color: #0000ff;"&gt;trip_id&lt;/SPAN&gt;= {"=Sum({&amp;lt;yr_wk = {'&amp;gt;=$(=&lt;SPAN style="color: #0000ff;"&gt;vMinWK&lt;/SPAN&gt;)&amp;lt;=$(=&lt;SPAN style="color: #0000ff;"&gt;vMaxWK&lt;/SPAN&gt;)'}&amp;gt;} &lt;SPAN style="color: #0000ff;"&gt;quantity&lt;/SPAN&gt;)&amp;gt;0"}&amp;gt;} distinct &lt;SPAN style="color: #0000ff;"&gt;trip_id&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both expressions give the same results, but seems aggr function performs faster. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much appreciated if anyone could help with this. if you have any recommandation to improve the performance of the expression, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;PJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:15:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253534#M96071</guid>
      <dc:creator>pjin_precima</dc:creator>
      <dc:date>2012-02-03T21:15:37Z</dc:date>
    </item>
    <item>
      <title>Help! use Aggregation function or use Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253535#M96072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could consider replacing the count(distinct trip_id) with a sum. Please refer to the manual, if I remember correctly chapter C.2 of book III, "Application Performance Optimization - Count (Distinct 'FieldName')", for some methods to do this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 22:00:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253535#M96072</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-03T22:00:12Z</dc:date>
    </item>
    <item>
      <title>Help! use Aggregation function or use Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253536#M96073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks swuehl,&lt;/P&gt;&lt;P&gt;I will test that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 22:07:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-use-Aggregation-function-or-use-Set-Analysis/m-p/253536#M96073</guid>
      <dc:creator>pjin_precima</dc:creator>
      <dc:date>2012-02-03T22:07:26Z</dc:date>
    </item>
  </channel>
</rss>

