<?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: Using Aggr function within set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642303#M456242</link>
    <description>&lt;P&gt;Try something like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;count({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;[Household ID]={"=count(distinct [Transaction Number])&amp;gt;2"}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;[Household ID])&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Nov 2019 06:55:27 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2019-11-03T06:55:27Z</dc:date>
    <item>
      <title>Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642228#M456240</link>
      <description>&lt;P&gt;Our data set&amp;nbsp;contains Household ID and Transaction Number, and I am trying to discover how many Households have more than 2 transactions within the last 4 months and I think I need to use the Aggr function to count the transactions by Household and then where ever this count is greater than 2 I need to count only those Households, so I am thinking I need to do something like this&lt;/P&gt;&lt;P&gt;count({$&amp;lt;aggr(count(distinct [Transaction Number]), [Household ID])&amp;gt;2}&amp;nbsp; [Household ID])&lt;/P&gt;&lt;P&gt;where [Transaction Number] and [Household ID] are fields in our data set.&lt;/P&gt;&lt;P&gt;but it is returning no values, where am I going wrong?&lt;/P&gt;&lt;P&gt;Thanks, Hailey&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 21:20:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642228#M456240</guid>
      <dc:creator>SaveonHailey</dc:creator>
      <dc:date>2019-11-01T21:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642233#M456241</link>
      <description>&lt;P&gt;reply to my own post (not sure if this is correct)&lt;/P&gt;&lt;P&gt;I know I can get the result by using the if function as below but was trying to conserve resources by using set analysis&lt;/P&gt;&lt;P&gt;&lt;FONT size="1" color="#0000ff"&gt;sum&lt;/FONT&gt;&lt;FONT size="1"&gt;(&lt;/FONT&gt;&lt;FONT size="1" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT size="1"&gt;(&lt;/FONT&gt;&lt;FONT size="1" color="#0000ff"&gt;aggr&lt;/FONT&gt;&lt;FONT size="1"&gt;(&lt;/FONT&gt;&lt;FONT size="1" color="#0000ff"&gt;Count&lt;/FONT&gt;&lt;FONT size="1"&gt;(&lt;/FONT&gt;&lt;FONT size="1" color="#0000ff"&gt;distinct&lt;/FONT&gt; &lt;FONT size="1" color="#800000"&gt;[Transaction Number]&lt;/FONT&gt;&lt;FONT size="1"&gt;),&lt;/FONT&gt;&lt;FONT size="1" color="#800000"&gt;[Household ID]&lt;/FONT&gt;&lt;FONT size="1"&gt;,&lt;/FONT&gt;&lt;FONT size="1" color="#800000"&gt;Family&lt;/FONT&gt;&lt;FONT size="1"&gt;)&amp;gt;2,1,0)) &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 21:36:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642233#M456241</guid>
      <dc:creator>SaveonHailey</dc:creator>
      <dc:date>2019-11-01T21:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642303#M456242</link>
      <description>&lt;P&gt;Try something like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;count({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;[Household ID]={"=count(distinct [Transaction Number])&amp;gt;2"}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;[Household ID])&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2019 06:55:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642303#M456242</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-11-03T06:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642359#M456243</link>
      <description>&lt;P&gt;That did not work. Maybe I need to clarify, I made a slight mistake in my original post.&lt;/P&gt;&lt;P&gt;Our item sales data set&amp;nbsp;contains Household ID and Transaction Number and Item ID, and I am trying to discover how many Households have purchased each item more than 2 transactions within a selected time fram and I think I need to use the Aggr function to count the transactions by Household by Item ID and then whereever this count is greater than 2, I need to count only those Households, so I was thinking I need to do something like this, but this does not return any result and I think my syntax for the aggr function within the set analysis is wrong.&lt;/P&gt;&lt;P&gt;count({$&amp;lt;aggr(count(distinct [Transaction Number]), [Household ID], [Item ID])&amp;gt;2}&amp;nbsp; [Household ID])&lt;/P&gt;&lt;P&gt;where [Transaction Number] and [Household ID] and [Item ID] are fields in our data set.&lt;/P&gt;&lt;P&gt;I am new to set analysis and struggle with the syntax, particularly when using a function within the set analysis.&lt;/P&gt;&lt;P&gt;I can get the result using an if statement like below, but was under the assumption that using set analysis instead of if statements would free up resources and run faster.&lt;/P&gt;&lt;P&gt;sum(if(aggr(count(distinct [Transaction Number], [Household ID], [Item ID])&amp;gt;2,1,0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 01:42:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642359#M456243</guid>
      <dc:creator>SaveonHailey</dc:creator>
      <dc:date>2019-11-04T01:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642445#M456244</link>
      <description>&lt;P&gt;I made an adjustment to my expression and fixed a typo (I typed my previous answer on a mobile device)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;count({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;[Household ID]={"=count(distinct [Transaction Number]&lt;STRONG&gt;&amp;nbsp;&amp;amp;'|'&amp;amp;[Household ID] &amp;amp;'|'&amp;amp; [Item ID]&lt;/STRONG&gt; &amp;nbsp;)&amp;gt;2"}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;&amp;gt;}&lt;/STRONG&gt;[Household ID])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 08:47:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642445#M456244</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-11-04T08:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642560#M456245</link>
      <description>&lt;P&gt;Try and use this:&lt;/P&gt;&lt;P&gt;here,&lt;/P&gt;&lt;P&gt;numDate =num(date)&lt;/P&gt;&lt;P&gt;and,&amp;nbsp;vNumdate4monthsback=&amp;nbsp; num(today()-120)&lt;/P&gt;&lt;P&gt;=if(Count({&amp;lt;numDate = {"&amp;gt;= $(vNumdate4monthsback)"}&amp;gt;}HouseholdID &amp;amp; '-' &amp;amp;&amp;nbsp; ItemID)&amp;gt;2,Count({&amp;lt;num = {"&amp;gt;= $(numdate4monthsback)"}&amp;gt;}HouseholdID &amp;amp; '-' &amp;amp;&amp;nbsp; ItemID))&lt;/P&gt;&lt;P&gt;please revert if you have any more queries&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 14:22:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1642560#M456245</guid>
      <dc:creator>simrankaur</dc:creator>
      <dc:date>2019-11-04T14:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr function within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1644492#M456246</link>
      <description>&lt;P&gt;Hailey, have a Design Blog post that may be of some help too:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If any of the recent posts helped, do not forgot to use the Accept as Solution button to mark any that worked to give credit and let others know they worked.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 21:01:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Aggr-function-within-set-analysis/m-p/1644492#M456246</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-11-07T21:01:19Z</dc:date>
    </item>
  </channel>
</rss>

