SQL Server Analysis Services Multidimensional Modeling

Comprehensive documentation for building and managing multidimensional models.

Designing Actions

Actions in SQL Server Analysis Services (SSAS) are user-defined operations that can be initiated from a cube or a specific cell within a cube. They provide a way to link actions, reports, URLs, or even other SSAS actions to the context of data analysis. This allows users to perform deeper dives into data or trigger relevant business processes directly from their BI tools.

Types of Actions

SSAS supports several types of actions:

Creating an Action

Actions are typically defined within SQL Server Data Tools (SSDT) or directly using MDX scripts. When creating an action, you'll specify:

Example: Creating a Drillthrough Action

Let's say you want to enable users to see the individual sales transactions that make up the total sales for a specific product in a particular month. You would define a drillthrough action targeting the 'Sales' measure, associated with the 'Product' dimension and 'Date' dimension.


CREATE ACTION [New Action] ON CUBE
FROM
    [Adventure Works DW]
WHERE
    ([Measures].[Internet Sales Amount], [Product].[Product Categories].[Category].&[1], [Date].[Calendar Year].&[2014])
AS
    'Drillthrough to Sales Transactions',
    ACTIONS =
    {
        DRILLTHROUGH
        {
            [FactInternetSales].[SalesOrderNumber],
            [FactInternetSales].[OrderDate],
            [FactInternetSales].[CustomerName],
            [FactInternetSales].[ProductName],
            [FactInternetSales].[Quantity],
            [FactInternetSales].[UnitPrice],
            [FactInternetSales].[ExtendedSalesAmount]
        }
        ON 1
    }
            
Note: When designing drillthrough actions, ensure that the target tables and columns specified in the MDX are accessible and contain the desired detail information. The performance of drillthrough can be affected by the size of the source tables.

Example: Creating a URL Action

You can create a URL action to link to a product detail page on your company's website. The URL can include the product key for dynamic linking.


CREATE ACTION [Product Detail Link] ON [Product].[Product]
FROM
    [Adventure Works DW]
AS
    'View Product Details Online',
    ACTIONS =
    {
        URL
        PROPERTIES
        {
            URL PROPERTY = 'http://www.example.com/products?id=' +
                STRIP([Product].[Product Key].CURRENTMEMBER.PROPERTIES("KEY"))
        }
    }
            

Best Practices for Actions

Tip: Consider using MDX expressions for action conditions to dynamically show or hide actions based on user roles, data values, or other contextual information.