Dimensions in SQL Server Analysis Services

Dimensions are fundamental objects in SQL Server Analysis Services (SSAS) that provide descriptive attributes for the data in your cubes. They allow users to slice and dice measures, providing context and enabling analytical queries. Think of dimensions as the "who, what, where, when, and how" of your business data.

What are Dimensions?

In a star schema or snowflake schema, dimensions are typically represented by tables that contain descriptive text and hierarchical data. In SSAS, these tables are modeled into dimension objects that can be related to fact tables (which contain measures) through measure groups.

Key Concepts of Dimensions

Creating and Configuring Dimensions

Dimensions are typically created using SQL Server Data Tools (SSDT) or Visual Studio with Analysis Services projects. The process involves:

  1. Dimension Wizard: Guides you through selecting the source table(s), defining attributes, and creating hierarchies.
  2. Attribute Configuration: Setting properties like KeyColumns, NameColumn, and AttributeHierarchyEnabled.
  3. Hierarchy Design: Arranging attributes into logical levels to form navigational hierarchies.
  4. Member Property Definition: Adding additional descriptive attributes to dimension members.
  5. Dimension Type Selection: Choosing the appropriate dimension type based on your data model requirements.

Example: Product Dimension

Consider a 'Product' dimension with the following source table:

CREATE TABLE DimProduct (
    ProductKey INT PRIMARY KEY,
    ProductName VARCHAR(100),
    ProductCategory VARCHAR(50),
    ProductSubcategory VARCHAR(50),
    Brand VARCHAR(50),
    Color VARCHAR(20)
);

In SSAS, you would create a 'Product' dimension with:

Note: Properly designed dimensions are crucial for cube performance and user understandability. Ensure your dimensions are well-structured and contain relevant attributes.

Best Practices

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

Further Reading