Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to make Hierarchy In Qlikview

Hi All,

I have a data set as shown below.

I want to make a tree structure by using Hierarchy  function in QV

RegionNameStateNameCityName
NORTHDelhiDelhi
NORTHHaryanaGurgaon
SOUTHPONDICHERRYPondicherry
SOUTHTAMIL NADUChennai
SOUTHTAMIL NADUVillupuram
WESTGUJARATSurat
WESTMaharashtraKalyan-Dombivli (M Corp.)
WESTMaharashtraPune

Please help me.

10 Replies
Gysbert_Wassenaar

On the dimension tab of the properties window click on Edit Groups. Then create a new group and add RegionName, StateName and CityName.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi gwassenaar,

Thanks for you respone.

But my requirement is how to make a tree view structure by using load Hierarchy  function in QV.

Hierarchy.jpg

I can make this structure by righting an expression on a list box like this

 

=RegionName &' /' & StateName & '/' & CityName  and then by checking the Tree View option

Tree View.jpg

But here the problem is that i can not select Parents like West,North etc i can only select City name.

So i want to know if this tree view structure is possible by using Hierarchy load function in Qlikview and if it is possible then how to use it

Thanks

Not applicable
Author

Hi,

it is necessary to create adjacent nodes table (here it is ITEM named table) and then  to construct hierarchy table using it.

Reload document with this script and set NAME_FOR_TREE as a field name in list box, with 'Show as TreeView' selected.

Directory;

ORG_TABLE:

LOAD * INLINE [

    RegionName, StateName, CityName

    NORTH, Delhi, Delhi

    NORTH, Haryana, Gurgaon

    SOUTH, PONDICHERRY, Pondicherry

    SOUTH, TAMIL NADU, Chennai

    SOUTH, TAMIL NADU, Villupuram

    WEST, GUJARAT, Surat

    WEST, Maharashtra, Kalyan-Dombivli (M Corp.)

    WEST, Maharashtra, Pune

];

ITEM:

LOAD Distinct CityName as VALUE, CityName & '-City' as NODE_ID, StateName & '-State' as PARENT_NODE_ID resident ORG_TABLE;

LOAD Distinct StateName as VALUE,StateName & '-State' as NODE_ID, RegionName & '-Region' as PARENT_NODE_ID resident ORG_TABLE;

LOAD Distinct RegionName as VALUE,RegionName & '-Region' as NODE_ID,  RegionName & '-Region' as PARENT_NODE_ID resident ORG_TABLE;

HIERARCHY_TABLE:

Hierarchy(NODE_ID_H,PARENT_NODE_ID_H, ID, PARENT_NAME, NAME, NAME_FOR_TREE) load

NODE_ID,

NODE_ID as NODE_ID_H,

PARENT_NODE_ID as PARENT_NODE_ID_H,

VALUE as ID,

VALUE as NAME

resident ITEM;

Not applicable
Author

Hi  Krunoslav,

This is exactly what iam looking for.

Thank you very much for the help.

cristian_av
Creator III
Creator III

Thanks for your answer! It is very useful..

But I still have a question..

Which field should I use to link the hierarchy table with my fact table?

I thought it must the the Node_ID, but that field has the prefix "-City, -State.." and that prefix do not exists on my fact table..

Thanks!

Anonymous
Not applicable
Author

Hi..

Can you please help me creation of org chart in Qlikview.When i am trying to create org chart it saparate data based on the dashes but i have to saparate data based on the | in org chart..

please help me..

Thanks & regards,

Chandini

Not applicable
Author

Hi,

take a look into help for Hierarchy statement, there is property PathDelimiter, that can be used to define delimiter other than default '/'.

You should also update List Box, under its Properties->General set Show As TreeView with separator |

regards

jansen28
Contributor III
Contributor III

I was looking for the same and you made my work simple. Thanks Krunoslav Pap 

imhappiee
Contributor III
Contributor III

Any help on this issue

Hierarchy issue

Thanks  ahead

ANand