SQL Server Analysis Services

Comprehensive documentation for Microsoft SQL Server Analysis Services

Dimensions and Hierarchies in Analysis Services

Understand how dimensions and hierarchies are structured and used within SQL Server Analysis Services to enable effective data analysis and reporting.

What are Dimensions?

Dimensions provide the context for your data. In a cube or tabular model, dimensions are typically based on the descriptive attributes of your business. For example, a Time dimension might include attributes like Year, Quarter, Month, and Day. A Geography dimension could include Country, State, and City.

Dimensions allow users to slice and dice measures by various criteria, making it easier to understand business performance from different perspectives.

Dimension Attributes

Attributes are the individual descriptive columns within a dimension. Each attribute represents a unique characteristic of the dimension.

What are Hierarchies?

Hierarchies represent a parent-child relationship between attributes within a dimension. They allow users to navigate data at different levels of granularity.

For example, in a Time dimension, a hierarchy might look like:

Year
  Quarter
    Month
      Day

Similarly, a Product dimension could have a hierarchy:

Category
  Subcategory
    Product Name

Types of Hierarchies

Creating Dimensions and Hierarchies

In SQL Server Data Tools (SSDT) for Analysis Services, you define dimensions and their hierarchies through the Dimension Designer.

  1. Add a new dimension to your project.
  2. Select the source table(s) for your dimension.
  3. Define the key attributes and descriptive attributes.
  4. Create hierarchies by dragging and dropping attributes onto the Hierarchy pane.
  5. Define attribute relationships to ensure proper navigation and aggregation within the cube.

Tip

Well-designed dimensions and hierarchies are crucial for creating an intuitive and performant OLAP solution. Ensure that hierarchies reflect how users want to analyze the data.

Roles of Dimensions in Analysis

Dimensions are fundamental to business intelligence:

Important Considerations

  • Attribute Relationships: Ensure attribute relationships are correctly defined. A many-to-one relationship is standard between lower-level and higher-level attributes in a hierarchy.
  • Attribute Types: Choose appropriate attribute types (e.g., Regular, Skipped Level, Rolled Up) based on your data structure and reporting needs.
  • Performance: Optimize dimension designs for query performance by considering attribute sorting, indexing, and the use of dimension types (e.g., Slowly Changing Dimensions).

Example Scenario: Sales Analysis

Consider a sales cube. We might have:

Users can then analyze Sales Amount (a measure) by selecting specific products, customers, or time periods, and drill down through the defined hierarchies to gain deeper insights.