<?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, or aggr? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805523#M284391</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=COUNT({&amp;lt;Activated = {1}, Service = e({&amp;lt;Deactivated = {1}&amp;gt;}Service)&amp;gt;}DISTINCT Service)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=COUNT({&amp;lt;Activated = {1}&amp;gt;}DISTINCT Service)&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;COUNT({&amp;lt;Deactivated = {1}&amp;gt;}DISTINCT Service)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 15 Mar 2015 20:49:18 GMT</pubDate>
    <dc:creator>MK_QSL</dc:creator>
    <dc:date>2015-03-15T20:49:18Z</dc:date>
    <item>
      <title>Count distinct, or aggr?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805522#M284390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;in my app I have a number of transactions of services being activated/deactivated, and I want to &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;calculate the net number of activations, but some services have been registered several times as being activated. Then I only want to count it as one. How can I do this? In my example I want the calculation to be 2 instead of 4. Hopefully I have not simplified this too much, the real world is always more complex &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Mar 2015 20:22:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805522#M284390</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2015-03-15T20:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct, or aggr?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805523#M284391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=COUNT({&amp;lt;Activated = {1}, Service = e({&amp;lt;Deactivated = {1}&amp;gt;}Service)&amp;gt;}DISTINCT Service)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=COUNT({&amp;lt;Activated = {1}&amp;gt;}DISTINCT Service)&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;COUNT({&amp;lt;Deactivated = {1}&amp;gt;}DISTINCT Service)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Mar 2015 20:49:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805523#M284391</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-03-15T20:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct, or aggr?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805524#M284392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;but trying that I realize I simplified too much.&lt;/P&gt;&lt;P&gt;I added another column which complicates it a bit more.&lt;/P&gt;&lt;P&gt;I want Service A to be calculated as 1, as one subservice is still active. Then this calculation is wrong as it gives 0 for Service A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Mar 2015 21:36:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805524#M284392</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2015-03-15T21:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct, or aggr?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805525#M284393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count(Aggr(Count({&amp;lt;Activated = {1}&amp;gt;}DISTINCT Subservice), Service, Subservice)) - &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Count(Aggr(Count({&amp;lt;Deactivated = {1}&amp;gt;}DISTINCT Subservice), Service, Subservice))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2015 00:28:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805525#M284393</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-03-16T00:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct, or aggr?</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805526#M284394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to solve it myself, don't know if it was the most optimal solution, but it works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;I skipped column "Deactivated" and used -1 in "Activated" instead, and summarized the total aggregated per service, giving -1 if &amp;lt;0 and 1 if &amp;gt;0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Mar 2015 14:07:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-or-aggr/m-p/805526#M284394</guid>
      <dc:creator>annabergendal</dc:creator>
      <dc:date>2015-03-16T14:07:06Z</dc:date>
    </item>
  </channel>
</rss>

