Designing Dimensions

Dimensions are fundamental components of a multidimensional data model in SQL Server Analysis Services (SSAS). They provide the context for your data, allowing users to slice, dice, and analyze measures from various perspectives. This document guides you through the process of designing effective dimensions.

What are Dimensions?

In SSAS, dimensions represent the descriptive attributes of your business data. For example, in a sales cube, dimensions could include:

Each dimension consists of attributes that users will use to filter and group their data. These attributes can be organized into hierarchies for more sophisticated analysis.

Key Concepts in Dimension Design

Dimension Attributes

Attributes are the individual columns or fields that make up a dimension. They describe the members of the dimension. Key considerations for attributes include:

Hierarchies

Hierarchies allow you to define parent-child relationships between attributes, creating drill-down capabilities. Common examples include:

Designing intuitive and logical hierarchies is crucial for user experience.

Dimension Types

SSAS supports several dimension types, each with specific use cases:

Best Practices for Dimension Design

Normalize Your Data

Dimensions should be designed based on normalized relational tables. Avoid redundancy to ensure data integrity and efficient processing.

Choose Appropriate Granularity

The granularity of a dimension determines the lowest level of detail for its members. Ensure it aligns with your analytical requirements.

Define Meaningful Hierarchies

Create hierarchies that reflect the natural business structure and allow for intuitive exploration of data.

Use Attribute Types Correctly

Assign the correct attribute type to each attribute to leverage SSAS features like roll-ups and advanced querying.

Optimize for Performance

Consider using dimension perspectives, pre-calculated aggregations, and proper indexing to improve query performance.

Tip: For dimensions with a large number of members, consider using dimension perspectives or breaking them into smaller, more manageable dimensions to improve processing and query times.

Steps to Design a Dimension

  1. Identify Business Requirements: Determine the analytical perspectives needed by users.
  2. Identify Source Data: Locate the relevant columns in your data source views.
  3. Create the Dimension: Use SQL Server Data Tools (SSDT) to create a new dimension.
  4. Define Attributes: Add attributes from your source tables.
  5. Configure Attribute Properties: Set keys, names, attribute types, and other properties.
  6. Design Hierarchies: Create parent-child or natural hierarchies.
  7. Set Dimension Properties: Configure options like dimension type and storage mode.
  8. Process the Dimension: Load the dimension data into the SSAS database.
Note: When designing dimensions, always consider the end-user experience. The structure and naming conventions should be intuitive and easy to understand.

Example: Designing a 'Product' Dimension

Let's consider designing a 'Product' dimension from a 'DimProduct' table in your data warehouse.

CREATE DIMENSION [dbo].[DimProduct] WITH ( [dbo].[DimProduct].[ProductID] AS 'ProductID', [dbo].[DimProduct].[ProductName] AS 'ProductName', [dbo].[DimProduct].[ProductCategory] AS 'ProductCategory', [dbo].[DimProduct].[ProductSubcategory] AS 'ProductSubcategory' ) ENGINE =ANALYSIS;

In this example:

Further Reading