For analytical query results that contain a lot of data, it is good practice to compact the results into a hierarchy so that the business users can decide how to expand each level of the hierarchy to reach the details.
Below is an example of a analytical query result that displays the results for year, quarter, month and date, that has been compacted into a hierarchy. Notice the small arrows that appear alongside each node of the hierarchy. Clicking on these arrows disaggregates the measures by drilling-down to the next level of detail in the hierarchy, or they can be used to collapse the detail to aggregate the measures.

The benefit of this approach is that when the analytical query result first appears, the business user is not overwhelmed with data. Instead, the analytical query opens with a simpler, summarized view. Measures are aggregated to produce a smaller result set that is easier to work with.
In our example, the results are compacted in the rows with the node-totals displayed at the bottom with the sub-nodes displayed above. This is the default layout. However, it is possible to display the node-totals at the top with the sub-nodes displayed below. To do this use the header annotation @Analytics.settings.rows.totalsLocation: #TOP.
As well as in the rows, you can also compact the dimension in the columns. You can even compact both axis simultaneously.
The hierarchy is formed from the dimension relationships defined in the underlying cube of the analytical query. No separate hierarchy definition is required.
This type of hierarchy is referred to as a universal display hierarchy.
Note
Be careful not to confuse a universal display hierarchy with the use of a hierarchy CDS view. The former requires no additional CDS view, and is a mechanism that simply arranges the dimension in a analytical query into a hierarchy for improved appearance and navigation.A prerequisite to defining a universal display hierarchy is that totals must be enabled for all dimensions on the axis that is to be compacted.
Let's look at the code to implement a universal display hierarchy.

We first need a header annotation: @Analytics.settings.<rows / columns>.hierarchicalDisplay to enable the hierarchy by default when the analytical query launches. Here, you choose which axis the hierarchy applies to and also the initial expansion level of the hierarchy.
Then list the dimensions in the order of the hierarchy from top to bottom. Don't forget to specify that totals should appear for all dimensions in the rows.
Watch the video to learn how to implement a universal display hierarchy.
Note
Even if you don't define the universal display hierarchy in the analytical query, a business user can choose to compact the analytical query results in the rows or columns using the navigation controls of the reporting tool. The benefit of defining the universal display hierarchy in the CDS view of analytical query is that the initial query result appears hierarchically. This presents a more useable result set to the business user.