<?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: Count Distinct If in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703198#M253677</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot! It's perfect!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jul 2014 09:35:28 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-07-03T09:35:28Z</dc:date>
    <item>
      <title>Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703196#M253675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm struggling with an expression from yesterday about count distinct. I'm quite sure there is a simple solution for my problem, but I'm not able to find it.&lt;/P&gt;&lt;P&gt;I've these data:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="224" style="height: 210px; width: 199px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" width="59"&gt;ID&lt;/TD&gt;&lt;TD class="xl64" style="border-left: none;" width="64"&gt;Sub_ID&lt;/TD&gt;&lt;TD class="xl64" style="border-left: none;" width="53"&gt;value&lt;/TD&gt;&lt;TD class="xl64" style="border-left: none;" width="56"&gt;target&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;74&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;55,0000&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;77&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;86,0000&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;79&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;94,0000&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;95&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;79&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;91,0000&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;95&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;79&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;97,0000&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;95&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;105&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;11,4422&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;105&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;9&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;36,0000&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;105&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;123,0644&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;and I need to find the number of distinct ID for which the &lt;STRONG&gt;avg(value)&amp;gt;avg(target) &lt;/STRONG&gt;- in this example the number is 2, because for ID 74 e 105 avg(value)&amp;gt;avg(target).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with this expression:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Count(DISTINCT &lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;IF( avg(valore)&amp;gt;avg([target]),&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;ID))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;but it doesn't work because of &lt;STRONG&gt;avg&lt;/STRONG&gt; function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I remove the avg function, using the following expression:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Count(DISTINCT &lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;IF( (valore)&amp;gt;([target]),&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;ID))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I get a wrong result, in fact for example ID=79 is considered because there is at least one line where value is greater than target, even if avg(value) (94) is less than avg(target) (95) and it should not be considered.&lt;/P&gt;&lt;P&gt;Please, let me know if you have any suggestion.&lt;/P&gt;&lt;P&gt;Thanks in advance and best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 09:02:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703196#M253675</guid>
      <dc:creator />
      <dc:date>2014-07-03T09:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703197#M253676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you nest aggregation functions you need to use the aggr function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Count(DISTINCT&lt;/P&gt;&lt;P&gt;IF( aggr( avg(value),ID) &amp;gt;aggr(avg([target]),ID),&lt;/P&gt;&lt;P&gt;ID))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 09:14:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703197#M253676</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-07-03T09:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703198#M253677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot! It's perfect!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 09:35:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703198#M253677</guid>
      <dc:creator />
      <dc:date>2014-07-03T09:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703199#M253678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;I've another doubt related to this topic and &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I try to expose it using an example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I've this simple script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Catalog:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;ID, Target&lt;/P&gt;&lt;P&gt;1,10&lt;/P&gt;&lt;P&gt;2,5&lt;/P&gt;&lt;P&gt;3,100&lt;/P&gt;&lt;P&gt;4,8&lt;/P&gt;&lt;P&gt;5,20&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Values:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;ID,subID,DATE, Value&lt;/P&gt;&lt;P&gt;1, 1, 01/01/2014, 11&lt;/P&gt;&lt;P&gt;2, 1, 01/01/2014, 6&lt;/P&gt;&lt;P&gt;3, 1, 01/01/2014, 90&lt;/P&gt;&lt;P&gt;3, 2, 01/01/2014, 93&lt;/P&gt;&lt;P&gt;4, 1, 01/01/2014, 30&lt;/P&gt;&lt;P&gt;5, 1, 01/01/2014, 11&lt;/P&gt;&lt;P&gt;5, 2, 01/01/2014, 8&lt;/P&gt;&lt;P&gt;2, 1, 01/02/2014, 8&lt;/P&gt;&lt;P&gt;2, 2, 01/02/2014, 7&lt;/P&gt;&lt;P&gt;5, 1, 01/02/2014, 118&lt;/P&gt;&lt;P&gt;5, 2, 01/02/2014, 115&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My goal is to find how many IDs have average values greater than target, for the selected month and the previous month.&lt;/P&gt;&lt;P&gt;Basically, with this sample data I've this situation:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="182" style="width: 419px; height: 187px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="18" width="72"&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="66"&gt;&lt;/TD&gt;&lt;TD class="xl66" colspan="2" style="border-left-style: none; text-align: center;" width="141"&gt;&lt;STRONG style="font-size: 8pt;"&gt;01/01/2014&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" colspan="2" style="border-left-style: none; text-align: center;" width="130"&gt;&lt;STRONG style="font-size: 8pt;"&gt;01/02/2014&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="18" style="border-top: none;"&gt;&lt;STRONG style="font-size: 8pt;"&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&lt;STRONG style="font-size: 8pt;"&gt;Target&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&lt;STRONG style="font-size: 8pt;"&gt;=avg(Value)&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&lt;STRONG style="font-size: 8pt;"&gt;On Target&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&lt;STRONG style="font-size: 8pt;"&gt;=avg(Value)&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;On Target&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="18" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;10&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;11&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="color: #99cc00; font-size: 8pt;"&gt;&lt;STRONG&gt;Y&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="18" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;6&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="color: #99cc00; font-size: 8pt;"&gt;&lt;STRONG&gt;Y&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;7,5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="color: #99cc00; font-size: 8pt;"&gt;&lt;STRONG&gt;Y&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="18" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;100&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;91,5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;N&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="18" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;8&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;30&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG style="color: #99cc00;"&gt;Y&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="18" style="border-top: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;20&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;9,5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;N&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;116,5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="color: #99cc00; font-size: 8pt;"&gt;&lt;STRONG&gt;Y&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Therefore I've 3 IDs On Target in January and 2 IDs On Target in February.&lt;/P&gt;&lt;P&gt;To calculate ID on target in selected month and in previous month I use this two expressions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Current Month:&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="padding-left: 30px;"&gt;=&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Count(DISTINCT &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;IF( aggr(avg(Value),ID)&amp;gt;Target,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ID)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;)&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Previous Month:&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P style="padding-left: 30px;"&gt;=&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Count(&amp;nbsp; DISTINCT &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;IF( aggr(avg({$&amp;lt;[DATE] = {"$(=(AddMonths(Date([DATE]),-1)))"}&amp;gt;} Value),ID)&amp;gt;Target,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;ID)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that when I select February, I got a wrong result for IDs on Target in previous month. With this expression I got only 1 IDs for January but the correct result is &lt;STRONG&gt;3&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;I guess that the problem is because when I select february only ID 2 and 5 are considered, and therefore in January only one of this two is on target.&lt;/P&gt;&lt;P&gt;Do you have any suggestion on how can I consider all IDs with the previous expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 14:57:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703199#M253678</guid>
      <dc:creator />
      <dc:date>2014-07-04T14:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703200#M253679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try adding the set modifier to the outer COUNT aggregation function too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 15:01:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703200#M253679</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-07-04T15:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703201#M253680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works! Thanks again! You're a great EXPERT!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 15:52:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703201#M253680</guid>
      <dc:creator />
      <dc:date>2014-07-04T15:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703202#M253681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;I was reading your post &lt;A href="https://community.qlik.com/docs/DOC-4252"&gt;Calculating rolling n-period totals, averages or other aggregations&lt;/A&gt; but I'm not able to use it on my example.&lt;/P&gt;&lt;P&gt;Basically I want to display this measure:&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;=&lt;SPAN style="font-weight: inherit; font-size: 10pt; font-family: inherit;"&gt;Count(DISTINCT&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;IF( aggr(avg(Value),ID)&amp;gt;Target,&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;ID)&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;in a bar chart with last six motnhs in X axis (without considering the selected month). Here below an example usign previous sample data (with further data for additional months).&lt;/P&gt;&lt;P&gt;&lt;IMG alt="pic1.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/61923_pic1.jpg" /&gt;&lt;/P&gt;&lt;P&gt;I've tryed with this expression:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;=Count( &lt;STRONG&gt;{$&amp;lt;[DATE] = {"&amp;gt;$(=(AddMonths(Date(Max([DATE])),-6)))"}&amp;gt;}&lt;/STRONG&gt; DISTINCT&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;IF( aggr(avg(&lt;STRONG&gt;{$&amp;lt;[DATE] = {"&amp;gt;$(=(AddMonths(Date(Max([DATE])),-6)))"}&amp;gt;}&lt;/STRONG&gt;Value),ID)&amp;gt;Target,&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;ID)&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;but it doesn't work.&lt;/P&gt;&lt;P&gt;I hope you can help me once again to find the correct solution.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jul 2014 10:11:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703202#M253681</guid>
      <dc:creator />
      <dc:date>2014-07-08T10:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Count Distinct If</title>
      <link>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703203#M253682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was missing [DATE] parameter for the aggr() function.&lt;/P&gt;&lt;P&gt;The correct expression is as follow:&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;=Count( &lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;{$&amp;lt;[DATE] = {"&amp;gt;$(=(AddMonths(Date(Max([DATE])),-6)))"}&amp;gt;}&lt;/STRONG&gt; DISTINCT&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;IF( aggr(avg(&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;{$&amp;lt;[DATE] = {"&amp;gt;$(=(AddMonths(Date(Max([DATE])),-6)))"}&amp;gt;}&lt;/STRONG&gt;Value),&lt;EM style="color: #3d3d3d; font-family: inherit; font-weight: inherit;"&gt;[DATE]&lt;/EM&gt;,ID)&amp;gt;Target,&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;ID)&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jul 2014 13:22:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-Distinct-If/m-p/703203#M253682</guid>
      <dc:creator />
      <dc:date>2014-07-08T13:22:53Z</dc:date>
    </item>
  </channel>
</rss>

