<?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: Distinct count by month without double counting in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344410#M836226</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;find output&lt;IMG alt="output.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/164922_output.png" style="height: 348px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 May 2017 18:17:05 GMT</pubDate>
    <dc:creator>alis2063</dc:creator>
    <dc:date>2017-05-26T18:17:05Z</dc:date>
    <item>
      <title>Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344403#M836219</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 want a to calculate unique count of Serial Numbers tested in each month. The relevant fields being used are "SN" and "MonthYear". I&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; tried to use Count( Distinct(SN) but the problem is some serial numbers were tested across more than one month and I don't want them to be double counted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; For example...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Jan-16&lt;/P&gt;&lt;P&gt; SN1&lt;/P&gt;&lt;P&gt; SN2&lt;/P&gt;&lt;P&gt; SN3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Feb-16&lt;/P&gt;&lt;P&gt; SN3&lt;/P&gt;&lt;P&gt; SN4&lt;/P&gt;&lt;P&gt; SN5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; In this scenario Count( Distinct(SN) would return a count of 3 for both months, but what I want is for 3 to be returned for Jan-16 and 2 to be returned for Feb-16. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344403#M836219</guid>
      <dc:creator>devan9876</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344404#M836220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;are you trying to do this in the front (Tables Charts) or in the Data Model &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 15:27:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344404#M836220</guid>
      <dc:creator>ziadm</dc:creator>
      <dc:date>2017-05-26T15:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344405#M836221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chart --Straight or Pivot Table&lt;/P&gt;&lt;P&gt;Dimension -- Month Name&lt;/P&gt;&lt;P&gt;Expression -- Count(Distinct SN)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 15:29:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344405#M836221</guid>
      <dc:creator>ziadm</dc:creator>
      <dc:date>2017-05-26T15:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344406#M836222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a chart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 15:46:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344406#M836222</guid>
      <dc:creator>devan9876</dc:creator>
      <dc:date>2017-05-26T15:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344407#M836223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add an extra field in the script that keeps track of when a SN first appeared:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SN,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Not Exists(SN),1,0) as IsNewSN&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use that new field in a set analysis expression: count({&amp;lt;IsNewSN={1}&amp;gt;} distinct SN)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 15:47:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344407#M836223</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-05-26T15:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344408#M836224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dimension MonthName&lt;/P&gt;&lt;P&gt;Sorry Expression will be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count(aggr(Count ( {1&amp;lt;MonthName = &amp;gt;} DISTINCT&amp;nbsp; SN) , SN))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 15:52:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344408#M836224</guid>
      <dc:creator>ziadm</dc:creator>
      <dc:date>2017-05-26T15:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344409#M836225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will have to write the script as below to fulfill your requirement,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Jan]:&lt;/P&gt;&lt;P&gt;load * inline [ID,Month&lt;/P&gt;&lt;P&gt;SN1,Jan&lt;/P&gt;&lt;P&gt;SN2,Jan&lt;/P&gt;&lt;P&gt;SN3,Jan&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Feb:&lt;/P&gt;&lt;P&gt;load * where not exists(ID);&lt;/P&gt;&lt;P&gt;load * inline [ID,Month&lt;/P&gt;&lt;P&gt;SN3,Feb&lt;/P&gt;&lt;P&gt;SN4,Feb&lt;/P&gt;&lt;P&gt;SN5,Feb&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;output&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 17:52:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344409#M836225</guid>
      <dc:creator>alis2063</dc:creator>
      <dc:date>2017-05-26T17:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344410#M836226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;find output&lt;IMG alt="output.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/164922_output.png" style="height: 348px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 18:17:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344410#M836226</guid>
      <dc:creator>alis2063</dc:creator>
      <dc:date>2017-05-26T18:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by month without double counting</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344411#M836227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Devan!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we talk about fixed values of field like months and you don't want to change your script, you can use this non-trivial method ↓&lt;/P&gt;&lt;P&gt;(The disadvantage of it's for each month you'll have to create a separate expression)&lt;/P&gt;&lt;P&gt;For 'Jan' it will be: Count(DISTINCT {&amp;lt;mnt={'Jan'}&amp;gt;}sn)&lt;/P&gt;&lt;P&gt;For 'Feb': Count(DISTINCT {&amp;lt;mnt={'Feb'},sn=e({&amp;lt;mnt={'Jan'}&amp;gt;}sn)&amp;gt;}sn)&lt;/P&gt;&lt;P&gt;For 'Mar': Count(DISTINCT {&amp;lt;mnt={'Mar'},sn=e({&amp;lt;mnt={'Jan','Feb'}&amp;gt;}sn)&amp;gt;}sn)&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;Yeah, looks ugly, but it works &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;May be you'll find it usefull! !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 May 2017 13:08:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-by-month-without-double-counting/m-p/1344411#M836227</guid>
      <dc:creator>Sergey_Shuklin</dc:creator>
      <dc:date>2017-05-27T13:08:57Z</dc:date>
    </item>
  </channel>
</rss>

