Posted: 5/22/2012
So I have an SSAS cube that is pretty robust and rather complex. Now I want to build a dashboard on it. I want to fire a bunch of MDX queries at it and have it return data that I can populate into charts and graphs. And like most people in the "REAL WORLD" I want to have these chart and graphs populate based on user specifc data. Like a saleperson will see these charts and graphs populated with their own data. Not with someone elses. So I figure I will just add a parameter to my MDX queries that will filter based on who is view the chart. But apparently their is no solution that can handle sending an MDX query with a parameter. Here is one of my queries:
SELECT {[Measures].[t-4 Avg BR], [Measures].[t-8 Avg BR], [Measures].[t-12 Avg BR]}ON 0,NonEmpty({[Current Teams].[Current Team Structure].[Employee ID].&[2573].Children})ON 1FROM( SELECT {LastPeriods(12, [Dates].[Fiscal Calendar].[Fiscal Week].&[2012]&[12])} ON COLUMNS FROM [Weekly Sales Reporting] )
Data returned in SSMS looks like this:
t-4 Avg BR t-8 Avg BR t-12 Avg BRWk1-12 : 2573 $3,534 $3,443 $3,531Wk2-12 : 2573 $3,555 $3,451 $3,536Wk3-12 : 2573 $3,724 $3,495 $3,723Wk4-12 : 2573 $4,160 $3,639 $3,798Wk5-12 : 2573 $4,617 $4,075 $3,834Wk6-12 : 2573 $3,890 $3,723 $3,597Wk7-12 : 2573 $3,412 $3,568 $3,467Wk8-12 : 2573 $3,027 $3,594 $3,435Wk9-12 : 2573 $3,084 $3,850 $3,745Wk10-12 : 2573 $3,348 $3,619 $3,598Wk11-12 : 2573 $3,033 $3,222 $3,389Wk12-12 : 2573 $3,143 $3,085 $3,444
I highlighted the values I wanted to parameterize. I have tried SSRS and Performance Point but I cannot seem to get anywhere. In Performance point I can add a parameter but I have to set a default and there is no way to change it at run time. In SSRS I can get it to work by using the StrToMember function but this falls apart because 1) it takes forever to run for some reason and 2) I lose the row names "Wk1-12 : 2573". Any ideas will help.
Posted: 5/23/2012
I have made no progress on this. It looks like there is no reason to ever develop SSAS cube if there is no tool that can query the data based on parameters to display in canned reports and charts. What a waste of my time learning MDX and SSAS.
You can do this relatively easily with SSRS.
Although it can be a bit frustrating to start with it's not hard once you've got the hang of it.
Thanks for the commiseration. I am making progress using SSRS and the StrToMember function but I am getting performance issues. I will figure it out and post.
I don't know the structure of you cube.
If it's performing well in SSMS but not in SSRS use profiler to see whats happening
It comes back instantaneously in the Query designer and SSMS. But as soon as I deploy to the SSRS server or preview the report it drags takes 5 seconds. I will try and use profiler. I didn't even know I could use it against an SSAS db. There are reason why I am using a subselect. I will try and explain the reasons if I can't figure it out using profiler. Thanks again.
Here is what my current query looks like. I am using the [Current Teams] in a subselect because since it is dynamic I have SSRS can't doesn't allow me to use the dimension value in my chart because there is no metadata. The reason I am using date in a subselect rather than a where is because I get an error when using LastPeriods function in the where. I will am trying the profiler right now.
SELECT {[Measures].[t-4 Avg BR], [t-8 Avg BR], [t-12 Avg BR], [BR]}ON 0,[Current Teams].[Current Team Structure].[Employment History Key] ON 1
FROM ( SELECT StrToSet("NonEmpty([Current Teams].[Current Team Structure].[Employee ID].&[" + @EmployeeID + "].Children)") ON COLUMNS FROM ( SELECT StrToSet("LastPeriods(53, [Dates].[Fiscal Calendar].[Fiscal Week].&[" + @FiscalYear + "]&[" + @FiscalWeek + "])") ON COLUMNS FROM [Weekly Sales Reporting] ) )
I figured it out! It had nothing to do with my current query at all. In the same report I had tried building a filter based on a drop down populated from the cube. That data set was generating all member of my organizational hierarchy. I scrapped the filter but there was a hidden data set that was still in the report that query the cube to return all members of the organization hiearchy. So I deleted the hidden data set and the chart comes back with data intantly.
So this my current method of build a dynamic query using StrToMember and StrToSet works perfectly. I am not going to spend my time learning how to make Performance Point work. However I think my issues with performance point would revolve around kerberos authenication settings.
Thanks, for the help!
Sam