<?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: Combining Set Analysis with AGGR - Assistance Needed in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665811#M242349</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I see what you're doing here, and this was one approach that crossed my mind, but unfortunately i'm dealing with hundreds of coupon codes and the list grows all the time, so hard-coding a field for each coupon isn't really going to work.&amp;nbsp; Additionally i have several time buckets in which to count orders (30, 60, 90 days, etc).&lt;/P&gt;&lt;P&gt;I guess i'm back to the drawing board unless anyone has other ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Sep 2014 00:37:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-09-23T00:37:47Z</dc:date>
    <item>
      <title>Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665807#M242345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to show total number of orders placed within 30 days prior to the date each person first used selected coupon code.&amp;nbsp; &lt;/P&gt;&lt;P&gt;So i need to see the first date each person used the selected coupon code, then how many orders (with any coupon code) they placed in the 30 days prior to that date, then sum that count at a global level.&amp;nbsp; Everything i have tried so far just keeps applying the date range at a global level instead of per person (i.e. if the coupon was first used by anyone on 3/1/14, then it just counts all orders placed 30 days prior to 3/1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking this requires something like the below, but this returns no results:&lt;/P&gt;&lt;P&gt;sum(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGGR(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(DISTINCT {&amp;lt;Date = {"$(= '&amp;lt;' &amp;amp; min({&amp;lt;Coupon = $(vCoupon)&amp;gt;} Date) &amp;amp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;gt;='&amp;nbsp; &amp;amp; min({&amp;lt;Coupon = $(vCoupon)&amp;gt;} Date)-10)"} &amp;gt;} Orderid),Person))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a test doc that has some sample data, and i'm using the text box to test out expressions.&amp;nbsp; Any help or questions to clarify are welcomed.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2014 18:01:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665807#M242345</guid>
      <dc:creator />
      <dc:date>2014-09-22T18:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665808#M242346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You won't be able to use set analysis here, since each date every person used the coupon will be different (set analysis is evaluated on the whole set, not individually). You'll have to use an if statement like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=count(distinct aggr(if(Date&amp;lt;min(total &amp;lt;Person&amp;gt; {&amp;lt;Coupon = {'$(vCoupon)'}&amp;gt;} Date) and Date&amp;gt;=min(total &amp;lt;Person&amp;gt; {&amp;lt;Coupon = {'$(vCoupon)'}&amp;gt;} Date)-10, Orderid), Person,Date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2014 18:54:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665808#M242346</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2014-09-22T18:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665809#M242347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jeremiah.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I did have a variation of this almost working with an IF statement originally, and this one does appear to get what i need, but due to the amount of records i'm dealing with (&amp;gt;375MM) it takes an excessively long time (i.e. 30 minutes!) to render the chart displaying the data.&amp;nbsp; I read somewhere on the Community that it was a best practice to use Set Analysis in place of IF statements to optimize processing.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there no way to concatenate the statement to use the set analysis?&amp;nbsp; Or other approach?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2014 19:07:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665809#M242347</guid>
      <dc:creator />
      <dc:date>2014-09-22T19:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665810#M242348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well since the min date changes for each person, set analysis can't be done (set analysis evaluates on the whole set and won't change the min(Date) for each person). So I think the best option is putting as much as you can in the loadscript. This will increase reload time a bit, but will improve the time the chart renders on front-end. For this, we can create flags. So I added this script in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//Added code here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join(temp)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load Person, min(Date) as XYZMinDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where Coupon='XYZ'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group by Person; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//End Added Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load Person,Orderid,Date,Coupon,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;num(Date) as numDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//Added code here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(Date &amp;lt; XYZMinDate and Date &amp;gt;= XYZMinDate -10, 1, 0) as XYZMinFlag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//End Added Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;resident temp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, you'll have to add a flag for each coupon (so if you have many coupons, might have to change this up by maybe making a loop or entirely different approach).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then used the expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count({&amp;lt;$(vCoupon)MinFlag = {1}&amp;gt;} distinct Orderid)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2014 20:19:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665810#M242348</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2014-09-22T20:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665811#M242349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I see what you're doing here, and this was one approach that crossed my mind, but unfortunately i'm dealing with hundreds of coupon codes and the list grows all the time, so hard-coding a field for each coupon isn't really going to work.&amp;nbsp; Additionally i have several time buckets in which to count orders (30, 60, 90 days, etc).&lt;/P&gt;&lt;P&gt;I guess i'm back to the drawing board unless anyone has other ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 00:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665811#M242349</guid>
      <dc:creator />
      <dc:date>2014-09-23T00:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665812#M242350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What you could try is doing a loop. It will make your loadscript complex and may take a bit of time to reload, but the dashboard experience should improve. I have attached an example real quick that works with your example. You can use some of it or try to improve but you'll have to test out and see if it improves the time the chart renders. Check the expression in the red textbox as well the script. For the buckets, you can add a new field for each bucket to my script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also like you said, maybe there is a different approach you can do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 17:57:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665812#M242350</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2014-09-23T17:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Set Analysis with AGGR - Assistance Needed</title>
      <link>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665813#M242351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much, after i finally took the time to understand what you were doing here, it works like a charm!&amp;nbsp; The reload time is huge, but i'd rather have that than slow rendering.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 14:53:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Combining-Set-Analysis-with-AGGR-Assistance-Needed/m-p/665813#M242351</guid>
      <dc:creator />
      <dc:date>2014-10-06T14:53:20Z</dc:date>
    </item>
  </channel>
</rss>

