<?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 Distinct count aggregation in hierarchies in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298797#M110778</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Thank you very much for your quick replies.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Actually my hierarchies are notregular in the sense that all categories don't have allthe same number of descendants. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;The hierarchies are stored in atable where each line correspond to a node and contains the category id, itsname, parent id and depth : ID_CATEGORY NAME_CATEGORY PARENTID_CATEGORYDEPTH_CATEGORY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;I load the hierarchy like this: &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 9pt;"&gt;Hierarchy&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;ID_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;PARENTID_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;NAME_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"RESULT_CATEGORY_PARENT"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt; NAME_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"RESULT_CATEGORY_PATH"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"&amp;gt;"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"RESULT_NOMEN_DEPTH"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;)&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;I have then a table of listing"events" caused by a user and related to products: ID_EVENTS, ID_USER,ID_PRODUCT and a join table that associate products to categories. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;At the end, for each categoryof my hierarchies, I want to count the distinct number of products and thedistinct numbers of users, for the category and for the category and itschildren.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Thanks again for you help !&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jan 2012 13:37:59 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-01-23T13:37:59Z</dc:date>
    <item>
      <title>Distinct count aggregation in hierarchies</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298794#M110775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe that's a newbie question but I'm unable to find an answer to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's very simple : I've got a hierarchies of categories and I show them in a list with an associated distinct count expression.&lt;/P&gt;&lt;P&gt;so far, it's ok. &lt;/P&gt;&lt;P&gt;I would like to add now an expression that calculate the distinct count on the node itself and its children node.&lt;/P&gt;&lt;P&gt;I cannot just sum the distinct count, because an item can be classified in multiple categories. &lt;/P&gt;&lt;P&gt;So for instance if a have a node N1 and 2 subnodes N1.1 and N1.2, and suppose that I have item I1 associated to N1, I2 associated to N1.1, and I2 and I3 asociated to N1.2, I want as a result :&lt;/P&gt;&lt;P&gt;N1 : 1 distinct item, 3 distinct items in total (including the subnodes)&lt;/P&gt;&lt;P&gt;N1.1 : 1 distinct item, 1 in total&lt;/P&gt;&lt;P&gt;N1.2 : 2 distinct items, 2 in total&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 12:39:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298794#M110775</guid>
      <dc:creator />
      <dc:date>2012-01-23T12:39:02Z</dc:date>
    </item>
    <item>
      <title>Distinct count aggregation in hierarchies</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298795#M110776</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;How is your model please?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 12:51:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298795#M110776</guid>
      <dc:creator>nstefaniuk</dc:creator>
      <dc:date>2012-01-23T12:51:16Z</dc:date>
    </item>
    <item>
      <title>Distinct count aggregation in hierarchies</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298796#M110777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi&amp;nbsp; &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/vincentsc" id="jive-6485015755596771715054" onmouseout="" onmouseover=""&gt;vincentsc&lt;/A&gt; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think having your model would be usefull, but i suspect you need aggr function. In example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(count(DISTINCT ITEM), N1, N2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;, I've supposed you have stored nodes on N1, N2 fields and Item level on a field called ITEM. Aggr function will do the count for each pair N1-N2 and then you only need to sum that values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 13:00:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298796#M110777</guid>
      <dc:creator>forte</dc:creator>
      <dc:date>2012-01-23T13:00:31Z</dc:date>
    </item>
    <item>
      <title>Distinct count aggregation in hierarchies</title>
      <link>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298797#M110778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Thank you very much for your quick replies.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Actually my hierarchies are notregular in the sense that all categories don't have allthe same number of descendants. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;The hierarchies are stored in atable where each line correspond to a node and contains the category id, itsname, parent id and depth : ID_CATEGORY NAME_CATEGORY PARENTID_CATEGORYDEPTH_CATEGORY.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;I load the hierarchy like this: &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 9pt;"&gt;Hierarchy&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;ID_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;PARENTID_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;NAME_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"RESULT_CATEGORY_PARENT"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt; NAME_CATEGORY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"RESULT_CATEGORY_PATH"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"&amp;gt;"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: 'Courier New'; font-size: 9pt;"&gt;"RESULT_NOMEN_DEPTH"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 9pt;"&gt;)&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;I have then a table of listing"events" caused by a user and related to products: ID_EVENTS, ID_USER,ID_PRODUCT and a join table that associate products to categories. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;At the end, for each categoryof my hierarchies, I want to count the distinct number of products and thedistinct numbers of users, for the category and for the category and itschildren.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: Arial, sans-serif; font-size: 10pt;"&gt;Thanks again for you help !&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jan 2012 13:37:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Distinct-count-aggregation-in-hierarchies/m-p/298797#M110778</guid>
      <dc:creator />
      <dc:date>2012-01-23T13:37:59Z</dc:date>
    </item>
  </channel>
</rss>

