SQL Server Analysis Services

Microsoft Learn

Designing Hierarchies in Multidimensional Modeling

Hierarchies are fundamental to multidimensional modeling in SQL Server Analysis Services (SSAS). They represent relationships between attributes in a dimension, allowing users to navigate and analyze data at different levels of granularity. Effective hierarchy design is crucial for creating intuitive and performant cubes.

What is a Hierarchy?

A hierarchy is a set of attributes organized in a parent-child relationship, forming a top-down structure. For example, in a 'Geography' dimension, you might have a hierarchy like 'Continent' > 'Country' > 'State/Province' > 'City'. Users can then drill down from the continent level to see data for individual countries, and further down to cities.

Types of Hierarchies

SSAS supports two primary types of hierarchies:

Creating Hierarchies in Visual Studio

You can create hierarchies using SQL Server Data Tools (SSDT) within Visual Studio.

  1. Open your SSAS project in Visual Studio.
  2. In the Solution Explorer, double-click the dimension you want to add a hierarchy to.
  3. Navigate to the 'Browser' tab.
  4. From the 'Toolbox', drag and drop attributes onto the design surface to form your hierarchy. You can arrange them by dragging them into the desired order.
  5. To create a new hierarchy, right-click on the dimension and select 'New Hierarchy'. Choose the type of hierarchy (e.g., User Hierarchy).
  6. Name your hierarchy appropriately.
  7. Drag and drop attributes from the 'Data Source View' or 'Attributes' pane into the hierarchy structure.
Screenshot of SSAS Hierarchy Design in Visual Studio

Visual representation of hierarchy design in SSDT.

Best Practices for Hierarchy Design

Note: When designing hierarchies, remember to consider the end-user experience. The goal is to provide intuitive ways to slice and dice data.

Example: Date Hierarchy

A common and essential hierarchy is the date hierarchy. This allows users to analyze trends over time.

Year Quarter Month Day

In SSAS, you can often use the built-in date dimension features or create custom date dimensions with these hierarchies automatically generated or manually defined.

Key Considerations

By carefully designing hierarchies, you can unlock the full analytical potential of your SQL Server Analysis Services cubes, empowering users with deep insights into their business data.