SQL Server Analysis Services

Multidimensional Models

Creating Dimensions

This section provides comprehensive guidance on creating and configuring dimensions in SQL Server Analysis Services (SSAS) multidimensional models. Dimensions are fundamental components of a data warehouse, providing the business context for analytical queries.

Understanding Dimensions

Dimensions are tables that contain descriptive attributes about the data in your fact tables. They enable users to slice, dice, and filter data in meaningful ways. Common examples of dimensions include Time, Geography, Product, and Customer.

Types of Dimensions

SSAS supports several types of dimensions, each with specific use cases:

Steps to Create a Dimension

You can create dimensions using SQL Server Data Tools (SSDT) or by scripting using XMLA.

Using SQL Server Data Tools (SSDT)

  1. Open your Analysis Services project in SSDT.
  2. In Solution Explorer, right-click the Dimensions folder and select New Dimension.
  3. The Dimension Wizard will guide you through the process.
  4. Choose the source table(s): Select the tables from your data source view that will form the dimension.
  5. Define dimension attributes: Select the columns from the source table(s) that will become attributes.
  6. Identify the primary key: Specify the key column(s) for the dimension.
  7. Create hierarchies: Optionally, define user-defined hierarchies to represent drill-down paths.
  8. Name the dimension: Provide a descriptive name for your dimension.

Key Dimension Configuration Options

Important: When creating a Time dimension, consider using the built-in Time dimension generation features in SSDT for automated creation of common time attributes (Year, Quarter, Month, Day, etc.).

Example: Creating a Product Dimension

Let's assume you have a DimProduct table in your data source with columns like ProductKey, ProductName, Category, and Subcategory.

To create a Product dimension:


-- Conceptual steps in SSDT
1. Right-click Dimensions -> New Dimension.
2. Choose 'Use existing table'.
3. Select 'DimProduct' from your Data Source View.
4. Select 'ProductKey' as the Key Attribute.
5. Select 'ProductName', 'Category', 'Subcategory' as other attributes.
6. Define 'Category' as the parent of 'Subcategory', and 'Subcategory' as the parent of 'ProductName' to create a natural hierarchy.
7. Name the dimension 'Product'.
            

Best Practices

Tip: Regularly review and update your dimensions as your business requirements evolve.

Further Reading