Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Working with hierarchies

Hi,

I have created a hierarchie (geo type) in Qlickview:

This is the file:

jerar1.png

ans this is the script:

Jerarquia_pais:

Hierarchy(cod_geo, cod_padre, desc_geo, desc_padre, desc_geo, jerarquia_geografica , '|', profundidad) LOAD

cod_geo,

cod_padre,

desc_geo

FROM

(ooxml, embedded labels, table is Hoja1);

Now I have a listbox with the hierarchie working properly:

jerar2.png

the fact table is at low level of the hierarchie (ciudad).

My question:

Now I can only select in the listbox al  the low level (ciudad), is there anyway of selectiong at a higer level (pais)?,  and filtering that rows in the chart (see only data of this selected level)?

for examploe: select España and see data of: Madrid, Sevilla, Valencia, Zaragoza...

Thanks in advance.

4 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Working with hierarchies

I think you're looking for the HierarchyBelongsTo function instead of the Hierarchy function. You can find an explanation in this blog post: Unbalanced, n-level hierarchies


talk is cheap, supply exceeds demand
Highlighted
Creator II
Creator II

Re: Working with hierarchies

Thanks Gyspert,

Now I have created a HierarchyBelongsto.

Jerarquia_pais2:

HierarchyBelongsto (cod_geo, cod_padre, desc_geo, cod_padre, desc_padre, nivel)

LOAD

cod_geo,

cod_padre,

desc_geo

FROM

(ooxml, embedded labels, table is Hoja1);

My problem now: how can I make a listbox od treeview typw with this hierarchy??

I needd, something like:

jerar3.png

Thanks in advance!!

Highlighted
MVP
MVP

Re: Working with hierarchies

Here is a clipping from Henric Cronström's excellent article about Hierarchies

that shows probably what you are looking for. You need to have a Path with some kind of separator which you can specify - like for instance a / 

2015-05-16 #1.PNG

Highlighted
MVP & Luminary
MVP & Luminary

Re: Working with hierarchies

You can link your Jerarquia_pais2 hierarchybelongsto table with another table created with the hierarchy function. See the Treebridge and Trees table in the attached example. The Trees table contains a Treepath field that is used in a listbox to select a district. In the pivot table this district and the underlying districts are shown.

Note, there's also a way to select entire subtrees without a hierarchybelongsto table. First collapse the parent of the subtree you want to select and then select the parent node of that subtree. If you then expand it you'll see that the nodes below it are also selected. If you expand the node first and then select it only the node itself will be selected.

comm164279.png


talk is cheap, supply exceeds demand