<?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: Aggregation problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781291#M276770</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;Please find attached a sample application&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Mar 2015 15:23:03 GMT</pubDate>
    <dc:creator>maleksafa</dc:creator>
    <dc:date>2015-03-24T15:23:03Z</dc:date>
    <item>
      <title>Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781287#M276766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a problem that i am trying to fix related to Aggr&lt;/P&gt;&lt;P&gt;the expression is the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; H_Flag={'Tickets per hour'},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Transaction Date] = {"&amp;gt;=$(=min({&amp;lt;H_Flag={'PeopleCount'}&amp;gt;} [Transaction Date]))"}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;gt;}TIK_TickCount)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what basically i am trying to do is to sum the filed 'TIK_TickCount' where the Transaction Date is greater than the minimum Transaction date of the Flag 'PeopleCount'. &lt;/P&gt;&lt;P&gt;the problem is that the where condition is not being calculated for each dimension. in the below case i have two stores selected and you can see in the second expression it is returning the correct date per store, but when used in the first expression it is only returning the minimum value which is 02-Feb-2014 for both stores.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/81710_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 14:37:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781287#M276766</guid>
      <dc:creator>maleksafa</dc:creator>
      <dc:date>2015-03-24T14:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781288#M276767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Provide few lines of sample data please&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 14:46:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781288#M276767</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-03-24T14:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781289#M276768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set expressions are evaluated globally, outside the context of the dimensions, so you cannot use set expressions for what you are tryng to achieve. You have two options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use a Sum(If()) type expression. This can be a performance killer in large data sets.&lt;/LI&gt;&lt;LI&gt;Create flag during load (set 1 when condition is true) and use the flag in a set expression. This is possibly less flexible that the sum(if()) option, but should perform far better.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which option depends on what you are trying to achieve. The script option needs to be done at the level of granularity into which your users will want to drill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 14:48:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781289#M276768</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-03-24T14:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781290#M276769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sum(If()) is definitely a performace killer in my case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can't i use some sort of aggr() function so that the expression related to date (&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=min({&amp;lt;H_Flag={'PeopleCount'}&amp;gt;} [Transaction Date]))) &lt;/SPAN&gt;will be evaluated for each store (dimension)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 14:58:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781290#M276769</guid>
      <dc:creator>maleksafa</dc:creator>
      <dc:date>2015-03-24T14:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781291#M276770</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;Please find attached a sample application&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 15:23:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781291#M276770</guid>
      <dc:creator>maleksafa</dc:creator>
      <dc:date>2015-03-24T15:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781292#M276771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add this to your load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Join(Data)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Store,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Min([Transaction Date]) As MinDate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Data&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Where H_Flag = 'PeopleCount'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Group By Store;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Join (Data)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Distinct Store,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; [Transaction Date],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; If([Transaction Date] &amp;gt;= MinDate, 1, 0) As MinFlag&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident Data;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in a chart/table with Store as the dimension:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;sum({&amp;lt;H_Flag={'Tickets per hour'}, MinFlag={1}&amp;gt;} TIK_TickCount)&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 05:59:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781292#M276771</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-03-25T05:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781293#M276772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Try below for min of people count Transaction date expression&lt;/P&gt;&lt;P&gt;"&amp;gt;=$(=date(min(Total{&amp;lt;H_Flag={'PeopleCount'}&amp;gt;} [Transaction Date])))"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 06:18:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781293#M276772</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-25T06:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation problem</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781294#M276773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As already explained by Jonathan, Set Analysis will evaluate set expression globally not per line. so you need to work around your script or use If function.&lt;/P&gt;&lt;P&gt;Please check enclosed file.... Similar to what Jonathan has answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2015 07:17:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-problem/m-p/781294#M276773</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-03-25T07:17:42Z</dc:date>
    </item>
  </channel>
</rss>

