Analysis Services allows cube browsers like Excel to fire events which are handled by the Actions defined in the cube. In this blog post, I will explain a specific type of cube action called Reporting Action. Reporting Action enables information consumers to fire a SQL Server Report when a specific condition is met while browsing the cube.
For the purpose of Illustration I’m using cubes and sample reports from AdventureWorks. I have also created a pivot table sourced from AdventureWorks Cube as shown below (Figure 1). The Reporting Action appears when you right click and select Additional Actions from the pivot table.
The objective of this Reporting Action is four-fold:
1. To call the SQL Server Report. For this illustration, the Sales Reason Comparison report will be called from the Excel Pivot Table.
2. To call the report only when a condition is met. In this case, the report will be called only when the Fiscal Year and Product Category is selected either as Row/Column/Filter in the pivot table.
3. To supply parameters to the report.
4. To give a meaningful and dynamic title to the Report Action.
Figure 2 and 3 shows how the end-result should be. The steps to create the Reporting Action are explained below.
Steps to create the Reporting Action
1. From BIDS, open the Analysis Service cube project. Navigate to Actions. Right Click on Action Organizer and click New Reporting Action (Shown in Figure 4).
2. Select Target Type as Cells. For this example, Cells target type would be the best choice as we have to specify more than one dimension as conditional expression in the next step. (Figure 5)
3. Specify the path of the SQL Server Report in URL Access format as shown in Figure 5.
4. Now, it’s time to specify the conditions that make the Report visible to the Information Consumer. The condition expression should be a valid MDX expression. In this example, the Report Action should be visible only when the Fiscal Year and Product Category is selected. The MDX expression to achieve that is shown in Figure 6.
[Date].[Fiscal].CurrentMember.Level IS [Date].[Fiscal].[Fiscal Year] AND [Product].[Category].CurrentMember <> NULL
5. Next, supply the parameters to the report. As with conditional expression, the parameters should be a valid MDX expression The parameter name should be same as the one defined in the report (Figure 7). Since the parameter value in the report uses UniqueName, I’m using UniqueName as well.
TIP: In this example the SQL Server Report is Cube-based. Reporting Action can also be used with non-cube based database reports. For database reports, the MDX expression of parameter value can be modified to return the actual value instead of UniqueName. In such case, use [Product].[Category].CurrentMember.Value instead of [Product].[Category].CurrentMember.UniqueName.
UrlEscapeFragment([Product].[Category].CurrentMember.UniqueName)
UrlEscapeFragment([Date].[Fiscal].CurrentMember.UniqueName)
6. Now specify an MDX expression to supply the caption/title of the Report Action when the cube is browsed (Figure 8).
The following MDX expression is used to specify the title of the Report Action
"Sales Reason for "+ [Product].[Category].CurrentMember.Member_Caption + " in " + [Date].[Fiscal].CurrentMember.Member_Caption
IMPORTANT: It is important to note that the MDX expressions used in Conditional Expressions, Parameter Values and Caption must evaluate to valid values. If either one of them does not return a valid result, the Report Action will disappear when the cube is browsed. No errors are thrown, but the Report action just does not show up.
TIP: If your Report Action disappears from the scene, do not panic. The easiest way to debug is to switch the cube from Design view to Code View and comment out all the nodes containing MDX Expressions. Then un-comment one by one, deploy your cube and test again to find out the offending MDX expression.
That completes my example for Reporting Action on Analysis Services.
Benny Austin









July 20, 2009 at 23:53
Thank you so much for supplying the proper parameter syntax, I’ve been looking for this!
September 8, 2009 at 06:31
[...] Posts Custom SSIS Data Flow Component – Credit Card Number ValidatorReporting Action in Analysis ServicesRe-sizing Web Zone in SharePoint DashboardsHow to Automate Analysis Services Database Backup?Steps [...]
September 8, 2009 at 18:58
Related to this post, check-out Deploying Report Actions in Analysis Services – http://wp.me/pxNuz-7Z
October 10, 2009 at 05:46
Hi, I have followed this example. Everything works except that after entering a parameter, I don’t see my action anymore. I made a diff of the code with and without the parameter, and the only difference is this:
Step Name
[DIM SEQUENCE].[Step Name]
Any ideas?
October 10, 2009 at 18:10
hi Eric, if the action disappears then it’s an indication that atleast one attribute of the report action is invalid. For e.g the MDX expression specified as the condition or parameter or caption does not evaluate to a valid member at execution time. During development it’s a good practise to add the attributes one by one and test the action immediately so that if the action fails you can narrow down the problem to te last attribute added. In your case since you have already narrowed down the problem to the parameters, I would recommend the following:
1. Check whether the parameter name you specified in the action is same as the name given in the report.
2. If the report parameter is sourced from dataset, check whether the parameter expression you specified matches the value field of the report parameter. If you are using MDX dataset, just copy the MDX expression that goes into the value and UrlEscapeFragment(<>) and use it as parameter expression. If you are using a non-MDX dataset, then you may have to massage the parameter to match the value field of the report parameter for e.g use [Dim].[Attrib].CurrentMember.Value or [Dim].[Attrib].CurrentMember.Level.Ordinal
3. Test your MDX expression in Management Studion by framing a simple MDX statement. Keep the slicer as relevant as possible.
Hope this helps.
October 27, 2009 at 01:13
Hi,
Is there any way to pass more than one member through to the report?
for e.g If a user was browsing a hierarchy, the parameter could pass all members in the slice they selected the action from?
October 27, 2009 at 22:45
Ben, I haven’t personally tried that but my initial thoughts are that it may not be possible. Analysis Service uses URL access to trigger report action. URL access format for parameters with multiple values is specified by repeating the parameter name. For example: http://ReportServerWebServerName/VirtualPath?/ReportFolder/orders®ion=east®ion=west . This means in cube action the parameter names have to be repeated as many times as the members which is dynamic and Analysis Service does not allow duplicate parameter names.