<?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 Count distinct values from 2 different collumns in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228365#M80401</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Other choice based in Miguel example is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Data:&lt;BR /&gt;LOAD "Column A" as ColumnA, "Column B" as ColumnB, "Column A" &amp;amp; '/' &amp;amp; "Column B" AS KeyToCount INLINE [&lt;BR /&gt;Column A, Column B&lt;BR /&gt;Company 1, A&lt;BR /&gt;Company 2, B&lt;BR /&gt;Company 3, A&lt;BR /&gt;Company 1, A&lt;BR /&gt;Company 2, B&lt;BR /&gt;Company 2, A&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Step1:&lt;BR /&gt;LOAD ColumnA,&lt;BR /&gt; ColumnB,&lt;BR /&gt; count(KeyToCount) as KeyCount&lt;BR /&gt;RESIDENT Data&lt;BR /&gt;group by ColumnA, ColumnB;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE Data;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Apr 2011 18:39:07 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-26T18:39:07Z</dc:date>
    <item>
      <title>Count distinct values from 2 different collumns</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228363#M80399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;how can I count values from 2 different collumns?&lt;/P&gt;&lt;P&gt;Example:&lt;BR /&gt;Collumn A | Collumn B&lt;BR /&gt;Company 1 | A&lt;BR /&gt;Company 2 | B&lt;BR /&gt;Company 3 | A&lt;BR /&gt;Company 1 | A&lt;BR /&gt;Company 2 | B&lt;BR /&gt;Company 2 | A&lt;BR /&gt;&lt;BR /&gt;What I want is to count:&lt;BR /&gt;Company 1 A appears 2 times&lt;BR /&gt;Company 2 A appears 1 time&lt;BR /&gt;Company 2 B appears 2 times&lt;BR /&gt;Company 3 A appears 1 time&lt;/P&gt;&lt;P&gt;How can I do it?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2011 14:45:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228363#M80399</guid>
      <dc:creator />
      <dc:date>2011-04-25T14:45:10Z</dc:date>
    </item>
    <item>
      <title>Count distinct values from 2 different collumns</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228364#M80400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;If you search the forums you will find a lot of discussions about this, but this code may help you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Data:LOAD "Column A", "Column B", "Column A" &amp;amp; '/' &amp;amp; "Column B" AS KeyToCount INLINE [Column A, Column BCompany 1, ACompany 2, BCompany 3, ACompany 1, ACompany 2, BCompany 2, A]; Step1:NOCONCATENATE LOAD *RESIDENT DataORDER BY KeyToCount; DROP TABLE Data; Step2:LOAD *, If(KeyToCount = Previous(KeyToCount), RangeSum(Peek('KeyCount'), 1), 1) AS KeyCountRESIDENT Step1; DROP TABLE Step1;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Since I'm loading from INLINE tables I need to do some steps you can save if you sort in your SQL query when loading into memory.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;EDIT: Depending on your data, accumulating in the script will save rendering time in your charts. According to this script, you can easily now create a chart using KeyToCount as dimension and Max(KeyCount) as expression to get the results you expect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2011 15:00:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228364#M80400</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-04-25T15:00:13Z</dc:date>
    </item>
    <item>
      <title>Count distinct values from 2 different collumns</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228365#M80401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Other choice based in Miguel example is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Data:&lt;BR /&gt;LOAD "Column A" as ColumnA, "Column B" as ColumnB, "Column A" &amp;amp; '/' &amp;amp; "Column B" AS KeyToCount INLINE [&lt;BR /&gt;Column A, Column B&lt;BR /&gt;Company 1, A&lt;BR /&gt;Company 2, B&lt;BR /&gt;Company 3, A&lt;BR /&gt;Company 1, A&lt;BR /&gt;Company 2, B&lt;BR /&gt;Company 2, A&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;Step1:&lt;BR /&gt;LOAD ColumnA,&lt;BR /&gt; ColumnB,&lt;BR /&gt; count(KeyToCount) as KeyCount&lt;BR /&gt;RESIDENT Data&lt;BR /&gt;group by ColumnA, ColumnB;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE Data;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Apr 2011 18:39:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228365#M80401</guid>
      <dc:creator />
      <dc:date>2011-04-26T18:39:07Z</dc:date>
    </item>
    <item>
      <title>Count distinct values from 2 different collumns</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228366#M80402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you aren't trying to actually change the table structure, and just want the count in a chart, something like this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Dimension 1 = Collumn A&lt;BR /&gt;Dimension 2 = Collumn B&lt;BR /&gt;Expression = count("Collumn A") // or an ID, or whatever&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 02:23:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-values-from-2-different-collumns/m-p/228366#M80402</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-04-27T02:23:58Z</dc:date>
    </item>
  </channel>
</rss>

