SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Parameterised MDX (SSAS2008) from SSRS2008


Parameterised MDX (SSAS2008) from SSRS2008

Author
Message
jm99
jm99
SSC-Addicted
SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)SSC-Addicted (438 reputation)

Group: General Forum Members
Points: 438 Visits: 297
I'm trying to run a MDX query that contains the topcount() function and I wish to parameterised the count parameter. For example:

select
{ Measures.Meas1, Measures.Meas2 } on columns
topcount( nonempty({ dimension set}), 500, Measures.Meas2 ) on rows
from
cube


where the hardcoded 500 is replaced by a SSRS parameter.

(I know this could be done in the report by using the Top functionms on the widgets but I do not want the vaolume transfer of the excluded rows from SSAS to SSRS)

So far I've done:
1) Created a SSRS UI parameter @TopN
2) Added the parameter to the dataset's Parameter list as @TopN
3) Referenced @TopN in the topcount() MDX called

==> Unable to parse MDX error: Parameter @TopN not defined

4) Attempted to use the parameter dialog from the MDX builder to define @TopN but this insists that the parameter is related to a dimension.

Any ideas, apart from:
a) Pass all of the MDX result set and let SSRS sort it out or,
b) Create dynamic MDX statement using the VBA f(x) editor

Help appreciated.
nikitac
nikitac
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 102
Hello There,

Please follow below steps for the query to work. Please follow all the below steps in Query designer of SSRS.

Step 1 : Taking into consideration your sample code, You just need to add a variable @TopXCount instead of hardcoding it as '500'.

select
{ Measures.Meas1, Measures.Meas2 } on columns
topcount( nonempty({ dimension set}), @TopXCount, Measures.Meas2 ) on rows
from
cube

Step 2 : Goto 'Query Parameter' in query designer and Add below details
Parameter : TopXCount
Dimension : leave it blank
Hierarchy : Leave it blank
Multiple Values : leave it blank
Default : Say 5

Step 5 execute the query and check whether it is running for the default value.

If its successfully running then u r succeeded.:-)

Regards,
Nikita C.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search