<?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 Hierarchy with Group by? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572330#M62963</link>
    <description>&lt;P&gt;Is it possible to use the hierarchy expression WITH a group by in a load statement? For instance i have 12 monthly snapshots of employees in one table and i'd like to build the hierarchy for each month (i.e., the group by).&lt;/P&gt;&lt;P&gt;I tried this, but it didn't work. Load failed.&lt;/P&gt;&lt;P&gt;Hierarchy Table:&lt;/P&gt;&lt;P&gt;Hierarchy([employee_id], [supervisor_id], [name],'Manager',[name],'Hierarchy Path','/','Depth')&lt;BR /&gt;left Join&lt;BR /&gt;LOAD Distinct [supervisor_id]&lt;BR /&gt;DATE(effective) as effective,&lt;BR /&gt;Count([employee_id]) as TotalDirectReports&lt;BR /&gt;Resident Workers&lt;BR /&gt;Group By [supervisor_id],DATE(effective);&lt;/P&gt;</description>
    <pubDate>Fri, 02 Apr 2021 07:54:25 GMT</pubDate>
    <dc:creator>click-er</dc:creator>
    <dc:date>2021-04-02T07:54:25Z</dc:date>
    <item>
      <title>Hierarchy with Group by?</title>
      <link>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572330#M62963</link>
      <description>&lt;P&gt;Is it possible to use the hierarchy expression WITH a group by in a load statement? For instance i have 12 monthly snapshots of employees in one table and i'd like to build the hierarchy for each month (i.e., the group by).&lt;/P&gt;&lt;P&gt;I tried this, but it didn't work. Load failed.&lt;/P&gt;&lt;P&gt;Hierarchy Table:&lt;/P&gt;&lt;P&gt;Hierarchy([employee_id], [supervisor_id], [name],'Manager',[name],'Hierarchy Path','/','Depth')&lt;BR /&gt;left Join&lt;BR /&gt;LOAD Distinct [supervisor_id]&lt;BR /&gt;DATE(effective) as effective,&lt;BR /&gt;Count([employee_id]) as TotalDirectReports&lt;BR /&gt;Resident Workers&lt;BR /&gt;Group By [supervisor_id],DATE(effective);&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 07:54:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572330#M62963</guid>
      <dc:creator>click-er</dc:creator>
      <dc:date>2021-04-02T07:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Hierarchy with Group by?</title>
      <link>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572454#M62964</link>
      <description>&lt;P&gt;I am not sure what you are trying to do, but Hierarchy(..) is a prefix to a load statement with (at the very least), a node id and a parent id, along with other fields such as node names. It is not a complete load statement, so you can't left join to it.&lt;/P&gt;&lt;P&gt;When you are grouping by superviser id, you are collapsing the hierarchy, so the hierarchy will not work.&lt;/P&gt;&lt;P&gt;Its possible that this would work, but i cant say for sure as you have not provided enough information:&lt;/P&gt;&lt;PRE&gt;Hierarchy([employee_id], [supervisor_id], [name],'Manager',[name],'Hierarchy Path','/','Depth')
LOAD * 
Resident Workers

left Join
LOAD Distinct [supervisor_id]
DATE(effective) as effective,
Count([employee_id]) as TotalDirectReports
Resident Workers
Group By [supervisor_id],DATE(effective);&lt;/PRE&gt;&lt;P&gt;Also try&lt;/P&gt;&lt;PRE&gt;Hierarchy(employee_id, supervisor_id, name)
...&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Apr 2019 06:30:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572454#M62964</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2019-04-24T06:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Hierarchy with Group by?</title>
      <link>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572699#M62965</link>
      <description>&lt;P&gt;Many thanks. However, I should have been more specific. The Workers table has a snapshot of employees in Jan. And another snapshot of employees in Feb, March, April...Dec. etc. for all 12 months. So i need to apply the hierarchy 12 times (i.e., that is why I need to group by each Month (e.g., Date(effective). And then I was simply trying to join this table to the resident table (worker). Hope that helps explain what i was trying to do. Any more guidance would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 12:26:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Hierarchy-with-Group-by/m-p/1572699#M62965</guid>
      <dc:creator>click-er</dc:creator>
      <dc:date>2019-04-24T12:26:09Z</dc:date>
    </item>
  </channel>
</rss>

