<?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: Set analysis replaving Having in sql in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105988#M366299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to provide a sample to look at?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Aug 2016 01:28:39 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-08-02T01:28:39Z</dc:date>
    <item>
      <title>Set analysis replacing Having in sql</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105985#M366296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;i am trying to write a set analysis expression to calculate average&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=avg(&amp;nbsp;&amp;nbsp; IF(Aggr( Count( {&amp;lt;Monthaname={'&amp;lt;=$(=AddMonths( Max(monthname),-3))'},&amp;nbsp; Monthaname ={'&amp;gt;=$(=AddMonths( Max(monthname),-23))'} &amp;gt;}&amp;nbsp; Key), Key) &amp;gt;=5, Aggr( Miles, Key) ))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i am trying is to get average of all the miles group by Key and this Key should be repeated more than 5 times in last 24 month excluding last 3 months&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg: For August 2016 i am trying to filter the data for August 2014 to April 2016 so i got the condition&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; {&amp;lt;Monthaname={'&amp;lt;=$(=AddMonths( Max(monthname),-3))'},&amp;nbsp; Monthaname ={'&amp;gt;=$(=AddMonths( Max(monthname),-23))'} &amp;gt;} &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;and to einclude only the "&lt;SPAN style="font-size: 13.3333px;"&gt;Miles" where Key is &amp;gt;= 5 , i placed an if condition and aggregated the set by Key.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;i am getting a blank field &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;so&amp;nbsp; i&amp;nbsp; change&amp;nbsp; the set expression as below &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;avg( IF(Aggr( Count(Key), Key) &amp;gt;=5, Aggr({&amp;lt;Monthaname={'&amp;lt;=$(=AddMonths( Max(monthname),-3))'},&amp;nbsp; Monthaname ={'&amp;gt;=$(=AddMonths( Max(monthname),-23))'} &amp;gt;}&amp;nbsp; Miles, Key) ))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;But the average calculation is wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Can someone please advise&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 21:38:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105985#M366296</guid>
      <dc:creator>gouthamkk</dc:creator>
      <dc:date>2016-08-01T21:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis replaving Having in sql</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105986#M366297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this (I am assuming your set analysis is already working for you):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avg(Aggr(If(Count(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;{&amp;lt;Monthaname = {'&amp;lt;=$(=AddMonths(Max(monthname), -3))&amp;gt;=$(=AddMonths(Max(monthname), -23))'}&amp;gt;} &lt;/SPAN&gt;Key) &amp;gt;= 5, Sum(SegmentMiles)), Key)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 22:43:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105986#M366297</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-01T22:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis replaving Having in sql</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105987#M366298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;I tried this expression also. I am getting blank value.&lt;/P&gt;&lt;P&gt;thank you though&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 23:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105987#M366298</guid>
      <dc:creator>gouthamkk</dc:creator>
      <dc:date>2016-08-01T23:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis replaving Having in sql</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105988#M366299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to provide a sample to look at?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2016 01:28:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-replacing-Having-in-sql/m-p/1105988#M366299</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-08-02T01:28:39Z</dc:date>
    </item>
  </channel>
</rss>

