MDX and Parameters??

Who is online?  0 guests and 1 members
Home  »  Forums   »  microsoft business intelligence   »  analysis services   » MDX and Parameters??

MDX and Parameters??

Topic RSS Feed

Posts under the topic: MDX and Parameters??

Posted: 5/22/2012

Jedi Youngling 62  points  Jedi Youngling
  • Joined on: 4/23/2012
  • Posts: 11

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 1
FROM(
 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 BR
Wk1-12 : 2573   $3,534        $3,443        $3,531
Wk2-12 : 2573   $3,555        $3,451        $3,536
Wk3-12 : 2573   $3,724        $3,495        $3,723
Wk4-12 : 2573   $4,160        $3,639       $3,798
Wk5-12 : 2573   $4,617        $4,075       $3,834
Wk6-12 : 2573   $3,890        $3,723       $3,597
Wk7-12 : 2573   $3,412        $3,568       $3,467
Wk8-12 : 2573   $3,027        $3,594       $3,435
Wk9-12 : 2573   $3,084        $3,850       $3,745
Wk10-12 : 2573 $3,348        $3,619       $3,598
Wk11-12 : 2573 $3,033        $3,222      $3,389
Wk12-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

Jedi Youngling 62  points  Jedi Youngling
  • Joined on: 4/23/2012
  • Posts: 11

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.


Posted: 5/23/2012

Jedi Youngling 14  points  Jedi Youngling
  • Joined on: 7/15/2010
  • Posts: 7

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.


Posted: 5/23/2012

Jedi Youngling 62  points  Jedi Youngling
  • Joined on: 4/23/2012
  • Posts: 11

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.


Posted: 5/23/2012

Jedi Youngling 14  points  Jedi Youngling
  • Joined on: 7/15/2010
  • Posts: 7

I don't know the structure of you cube.

  1. But you could probably replace your sub select with a where clause, do you need the NonEmpty function?
  2. Using the sub select will force ssas to use a query session cache context.
  3. Is the query taking a long time in SSRS or is it rendering time?

If it's performing well in SSMS but not in SSRS use profiler to see whats happening


Posted: 5/23/2012

Jedi Youngling 62  points  Jedi Youngling
  • Joined on: 4/23/2012
  • Posts: 11

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.

 

 

 


Posted: 5/23/2012

Jedi Youngling 62  points  Jedi Youngling
  • Joined on: 4/23/2012
  • Posts: 11
Answered  Answered

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]
  )
 )


Posted: 5/23/2012

Jedi Youngling 62  points  Jedi Youngling
  • Joined on: 4/23/2012
  • Posts: 11
Answered  Answered

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


Page 1 of 1 (8 items)