<?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 IDs in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604187#M736260</link>
    <description>&lt;P&gt;Even this works in script&lt;/P&gt;&lt;P&gt;LOAD *, If(CustomerID&amp;lt;&amp;gt;Peek(CustomerID),1) as Flag Inline [&lt;BR /&gt;CustomerID, PriorityOrder&lt;BR /&gt;1, PRIO1&lt;BR /&gt;1, PRIO1&lt;BR /&gt;2, PRIO1&lt;BR /&gt;2, PRIO2&lt;BR /&gt;3, PRIO2&lt;BR /&gt;3, PRIO3&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;and KPI's are&lt;/P&gt;&lt;P&gt;Prior 1: Sum({&amp;lt;PriorityOrder={'PRIO1'}&amp;gt;} Flag)&lt;/P&gt;&lt;P&gt;Prior 2: Sum({&amp;lt;PriorityOrder={'PRIO2'}&amp;gt;} Flag)&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jul 2019 13:55:53 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2019-07-19T13:55:53Z</dc:date>
    <item>
      <title>Count distinct IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604162#M736258</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I love this forum :), got so much help already:&lt;/P&gt;&lt;P&gt;Question:&lt;/P&gt;&lt;P&gt;I have a table with Customer ID and Order Priority.&lt;/P&gt;&lt;P&gt;I want to count how many customers have Priority1 Orders, how many customers Priority2 ...&lt;/P&gt;&lt;P&gt;But, if customer1 already was counted as a Priority1 Order customer, I do not want to include this customer in the Priority2 count.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CustomerID&lt;/TD&gt;&lt;TD&gt;PriorityOrder&lt;/TD&gt;&lt;TD&gt;Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;PRIO1&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;PRIO1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;PRIO1&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;PRIO2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;PRIO2&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;PRIO3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result: 2 Customers with Prio1 Order, 1 Customer with Prio2 Order&lt;/P&gt;&lt;P&gt;I can either modify the load or the expression if required.&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604162#M736258</guid>
      <dc:creator>AutoMann</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604180#M736259</link>
      <description>&lt;P&gt;May be create a first time flag in the script like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table:
LOAD * INLINE [
    CustomerID, PriorityOrder
    1, PRIO1
    1, PRIO1
    2, PRIO1
    2, PRIO2
    3, PRIO2
    3, PRIO3
];

FinalTable:
LOAD *,
	 If(CustomerID &amp;lt;&amp;gt; Previous(CustomerID), 1, 0) as FirstTimeFlag
Resident Table
Order By CustomerID, PriorityOrder;

DROP Table Table;&lt;/LI-CODE&gt;&lt;P&gt;and then use this in your expression&lt;/P&gt;&lt;P&gt;Dimension&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PriorityOrder&lt;/LI-CODE&gt;&lt;P&gt;Expression&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(FirstTimeFlag)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:37:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604180#M736259</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-07-19T13:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604187#M736260</link>
      <description>&lt;P&gt;Even this works in script&lt;/P&gt;&lt;P&gt;LOAD *, If(CustomerID&amp;lt;&amp;gt;Peek(CustomerID),1) as Flag Inline [&lt;BR /&gt;CustomerID, PriorityOrder&lt;BR /&gt;1, PRIO1&lt;BR /&gt;1, PRIO1&lt;BR /&gt;2, PRIO1&lt;BR /&gt;2, PRIO2&lt;BR /&gt;3, PRIO2&lt;BR /&gt;3, PRIO3&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;and KPI's are&lt;/P&gt;&lt;P&gt;Prior 1: Sum({&amp;lt;PriorityOrder={'PRIO1'}&amp;gt;} Flag)&lt;/P&gt;&lt;P&gt;Prior 2: Sum({&amp;lt;PriorityOrder={'PRIO2'}&amp;gt;} Flag)&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:55:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-IDs/m-p/1604187#M736260</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2019-07-19T13:55:53Z</dc:date>
    </item>
  </channel>
</rss>

