<?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: Urgent aggr help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441836#M487493</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahaaaah, so that's why there's a nodistinct qualifier for aggr. I was very much in the dark about that. Thank you so much Stefan for enlightening me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Feb 2013 14:09:44 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-02-17T14:09:44Z</dc:date>
    <item>
      <title>Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441830#M487487</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 an urgent problem that I just cannot figure out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a list of members who have service calls. So one member may have several service calls on multiple dates.&lt;/P&gt;&lt;P&gt;The records also have pre- and post-day counts which indicate how long the person was a member before and after the service call date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to allow the report users to set a date range to use and then filter out any members whose *earliest* record is does not have a specified number of pre- and post-days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logic should work like this:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Look only at records whose service date is within the defined date range.&lt;/LI&gt;&lt;LI&gt;Find the earliest service date &lt;EM&gt;for each member &lt;/EM&gt;(referred to as the index date)&lt;/LI&gt;&lt;LI&gt;If &lt;EM&gt;that member's&lt;/EM&gt; service date is not proceeded for followed by the specified number of pre- and post- day counts, exclude it&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried the following set analysis, but it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13609540583892958" jivemacro_uid="_13609540583892958"&gt;&lt;P&gt;count (distinct &lt;/P&gt;&lt;P&gt; { $&amp;lt; POST_DAYS = {"&amp;gt;=$(vPostDays)"}, &lt;/P&gt;&lt;P&gt;&amp;nbsp; PRE_DAYS = {"&amp;gt;=$(vPreDays)"}, &lt;/P&gt;&lt;P&gt;&amp;nbsp; MBR_DATE = {"=MBR_DATE=Aggr(MinString(MBR_DATE),MBR_ID)"&amp;gt;&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; MBR_ID) &lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a sample QVW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One note: the actual data contains many more dimensions that I will need to allow users to use to filter, and it's not practical to pre-calculate every member's index&amp;nbsp; date, since the index date depends on what filters are applied.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone can help me solve this problem, I'd be very grateful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 19:00:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441830#M487487</guid>
      <dc:creator />
      <dc:date>2013-02-15T19:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441831#M487488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apart from a missing } your expression is correct as far as I can tell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;count (distinct { $&amp;lt; POST_DAYS = {"&amp;gt;=$(vPostDays)"},&amp;nbsp;&amp;nbsp; PRE_DAYS = {"&amp;gt;=$(vPreDays)"},&amp;nbsp;&amp;nbsp; MBR_DATE = {"=MBR_DATE=Aggr(MinString(MBR_DATE),MBR_ID)" &lt;SPAN style="color: #ff0000; font-family: Arial; background-color: #ffffff;"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/SPAN&gt; &amp;gt; } MBR_ID)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Something you might need to consider is that minstring could trip you up. 1.1/15/2013 is smaller than 1.1/2/2013. If your MBR_ID's are numbers you could use rangesum(MBR_ID*100000,num(date#(Date,'M/D/YYYY'))) to create a number field. That has the additional advantage you can use the min function which performs better than minstring. Calculationg with numbers is usually a lot faster than calculating with strings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 10:16:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441831#M487488</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-16T10:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441832#M487489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Do you know why the code you gave might be affected by the load order?&lt;/P&gt;&lt;P&gt;I tried changing the load order around to make sure it didn't affect the results, and when the records aren't ordered by Date, the expression doesn't return any results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the attached file for an example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 16:14:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441832#M487489</guid>
      <dc:creator />
      <dc:date>2013-02-16T16:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441833#M487490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No idea. I could reproduce it. It probably means we were trying something that can't/shouldn't be done like that and triggers calculations with undefined behaviour/results. The only thing that seems to do what I expect is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if(min({$&amp;lt;POST_DAYS=,PRE_DAYS=&amp;gt;}Date) = min({$&amp;lt;POST_DAYS={'&amp;gt;=$(vPostDays)'},PRE_DAYS=&lt;/EM&gt;&lt;EM&gt;{'&amp;gt;=$(vPreDays)'}&amp;gt;}Date),1)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 18:39:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441833#M487490</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-16T18:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441834#M487491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That seems like it's working in terms of filtering, but how do I use it to replace the count() expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I want to have a pie chart that shows counts of members of a gender. How would I do that? If I just use the if statement, it doesn't aggregate. So if I added a gender column and added another member with gender "F" to the inline table, the pie chart, without filters, would show 2 F and 1 M.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your advice, I feel like we're close to solving my problem!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt; I think this might do the trick:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13610447754092665" jivemacro_uid="_13610447754092665"&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;EM&gt;if(min({$&amp;lt;POST_DAYS=,PRE_DAYS=&amp;gt;}Date) = min({$&amp;lt;POST_DAYS={'&amp;gt;=$(vPostDays)'},PRE_DAYS=&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;EM&gt;{'&amp;gt;=$(vPreDays)'}&amp;gt;}Date),count(DISTINCT MBR_ID))&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT 2:&lt;/STRONG&gt; That doesn't seem to work quite right.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 19:14:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441834#M487491</guid>
      <dc:creator />
      <dc:date>2013-02-16T19:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441835#M487492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;bretwalker,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe you need to apply the NODISTINCT qualifier to your aggr() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;count (distinct { $&amp;lt; POST_DAYS = {"&amp;gt;=$(vPostDays)"},&amp;nbsp;&amp;nbsp; PRE_DAYS = {"&amp;gt;=$(vPreDays)"},&amp;nbsp;&amp;nbsp; MBR_DATE = {"=MBR_DATE=Aggr(&lt;STRONG&gt;NODISTINCT &lt;/STRONG&gt;MinString(MBR_DATE),MBR_ID)" } &amp;gt;} MBR_ID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check also attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 13:36:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441835#M487492</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-02-17T13:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441836#M487493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahaaaah, so that's why there's a nodistinct qualifier for aggr. I was very much in the dark about that. Thank you so much Stefan for enlightening me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 14:09:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441836#M487493</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-17T14:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent aggr help</title>
      <link>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441837#M487494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From my testing, I believe this is exactly what I was looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Stefan and Gysbert for all of your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 20:11:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Urgent-aggr-help/m-p/441837#M487494</guid>
      <dc:creator />
      <dc:date>2013-02-17T20:11:11Z</dc:date>
    </item>
  </channel>
</rss>

