Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ahammadshafi
Creator
Creator

Creating hierarchy in data column

Dear Experts:

My client wants to view a table with a hierarchy (Region-> Sub-Region -> Country).

Table.PNG

But they all come in a single column, "Country".

Data.PNG

Please find attached sample data.

My question would be, what is the best approach to create the hierarchy while/after loading the data? And how should I create the table in desired format (with proper spacing, parent->child like Nordics-> Norway)?

Ahammad Shafi

1 Solution

Accepted Solutions
t_chetirbok
Creator III
Creator III

Hi!

Find attachment! !

It's hierarchy and pivot table, but I'm not sure that it is possible to do vertical pivot

View solution in original post

2 Replies
t_chetirbok
Creator III
Creator III

Hi!

Find attachment! !

It's hierarchy and pivot table, but I'm not sure that it is possible to do vertical pivot

agustinbobba
Partner - Creator
Partner - Creator

Hi Ahammad,

First, you need to add the ID for the Node and the Parent. I attach the Excel file with the example.

Parent.png

Then you can use the Hierarchy Logic.

Aux:

LOAD Geo_Level,

     Country,

     ParentID,

     CountryID,

     Product,

     Type,

     Period,

     Value

FROM

[Sample Data.xlsx]

(ooxml, embedded labels, table is Data);

NoConcatenate

Hierarchy(CountryID, ParentID, Country)

LOAD Distinct

  CountryID,

  ParentID,

  Country

Resident Aux;

Table:

LOAD Geo_Level,

     CountryID,

     Product,

     Type,

     Period,

     Value

FROM

[Sample Data.xlsx]

(ooxml, embedded labels, table is Data);

drop Table Aux;

EXIT Script;

The result is something like that:

2016-03-21_12-40-47.png

Regards,

Agustin