<?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: Problem with Aggr and maxstring/minstring functions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305071#M585832</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;I think I have a solution to your problem, please see attached file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of the aggr, min/maxstring and if Functions, I used indirect set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;count({&amp;lt;Customer = p({&amp;lt;Category={'Blue'}, Outcome={'Sale'}&amp;gt;} Customer)*e({&amp;lt;Category={'Pink'}, Outcome={'Sale'}&amp;gt;} Customer) &amp;gt;} DISTINCT Customer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to count the blue customers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jul 2011 17:19:58 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2011-07-25T17:19:58Z</dc:date>
    <item>
      <title>Problem with Aggr and maxstring/minstring functions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305070#M585831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attaching a small sample showing the concept of what I am trying to accomplish.&amp;nbsp; Any help would be appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to count Sales - there could be a blue sale or a pink sale.&amp;nbsp;&amp;nbsp; There could also be a Combo sale - both pink and blue.&amp;nbsp; I am trying to use the maxstring and minstring of the type of sale - if the min and max are blue, then it's a blue sale.&amp;nbsp; If min and max are pink, then it's a pink sale.&amp;nbsp; If min is blue and max is pink, then it's a combo sale.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because of the way the real data is set up, there could be blank records as well, which I have included in the data.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot get this to work 100% of the time.&amp;nbsp; Any thoughts??? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the Sales by Color - Not working chart. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2011 16:42:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305070#M585831</guid>
      <dc:creator />
      <dc:date>2011-07-25T16:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Aggr and maxstring/minstring functions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305071#M585832</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;I think I have a solution to your problem, please see attached file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of the aggr, min/maxstring and if Functions, I used indirect set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;count({&amp;lt;Customer = p({&amp;lt;Category={'Blue'}, Outcome={'Sale'}&amp;gt;} Customer)*e({&amp;lt;Category={'Pink'}, Outcome={'Sale'}&amp;gt;} Customer) &amp;gt;} DISTINCT Customer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to count the blue customers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2011 17:19:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305071#M585832</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-07-25T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Problem with Aggr and maxstring/minstring functions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305072#M585833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;me again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was just curious why your solution haven't worked the first place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there might be two problem:&lt;/P&gt;&lt;P&gt;1) Blank records for Category&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which are not NULL, so that Minstring will return those blank records instead of 'blue'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fix this you might change the Load expression into:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD SalePerson, Customer, Outcome, if(Category='',Null(),Category) as Category INLINE&lt;/P&gt;&lt;P&gt;[....]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;the actual expression (here for combo):&lt;/P&gt;&lt;P&gt;Count(DISTINCT If([Outcome]='Sale' and not isnull(Category) and aggr(minstring([Category]), Customer) = 'Blue' and&amp;nbsp;&amp;nbsp; aggr(maxstring([Category]), Customer) = 'Pink' ,Customer))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With bob, you get a match here, even you shouldn't. The two conditions for color checking are fulfilled, and you have one record with Outcome = Sale, so it's a combo? No, it is not, because you have to disregard the records which are not 'Sale' also for color checking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you could rework this expression in a way that's correct, I assume you finally get something similar to a my set expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, too,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2011 18:26:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Aggr-and-maxstring-minstring-functions/m-p/305072#M585833</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-07-25T18:26:20Z</dc:date>
    </item>
  </channel>
</rss>

