Defining your hierarchies
Next, you will add a hierarchy to your logical model. Hierarchies is an optional business logic feature. It defines drill-down relationships between groups.
When you enable business logic, some hierarchies may be automatically created by Qlik Sense from your data model. If you navigate to Hierarchies, you can see that business logic has created two hierarchies.
Hierarchies indicate groups that can be used to break each other down in analysis. For example, the two hierarchies created by Qlik Sense correctly identify two drill-down relationships in our logical model:
The data in the Category fields can be broken down into the data in the Products fields.
The data in the Suppliers fields can be broken down into the data in the Products fields.
If you navigate to Sheet, click Discovery, and select CategoryName, Insight Advisor includes a tree map that breaks down CategoryName by ProductName.
Why define hierarchies?
Hierarchies enable you to define a drill-down relationship between groups in your logical model. This helps Insight Advisor creates analyses that breakdown your data, such as tree maps. Hierarchies also ensure that the preferred groups are used together for drill-down analysis.
In your data model, there is a geographic hierarchy between the data for countries and the data for cities. If you navigate to Sheet and generate charts for the field Country from Discovery, none of the generated results use the field City. We can solve this by adding a new hierarchy to our logical model.
Defining a hierarchy for SalesCountry and SalesCity.
Do the following:
Click Create hierarchy.
For Name, enter Country-City.
Select SalesCountry from Available groups and click > .
Select SalesCity from Available groups and click >.
Navigate to Sheet and click Discover. From the assets panel, select Country. You now have results that reflect the City-Country hierarchy, including a tree map that shows sum(Sales) by Country and City.