dbTalk Databases Forums  

NEWBIE MDX WHERE how to parameterise

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss NEWBIE MDX WHERE how to parameterise in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
wilb
 
Posts: n/a

Default NEWBIE MDX WHERE how to parameterise - 09-13-2006 , 06:38 AM






I would like to run an MDX query that looks something like:-

SELECT
{[Measures].[Enrolments]}
ON COLUMNS,
([College].[College Id].[College Id], [College].[College
Name].[College Name])
ON ROWS
FROM
[ACube]
WHERE
([College].[College Id].[@PARAM]);

This does not work because [College].[College Id] is on an axis and in
the slicer dimension.


My problem is that I want the MDX to return a dataset for reporting
services. If @PARAM is a numeric, data for one college is returned. If
@PARAM is "All", a list of colleges is returned. I need the College Id
to pass into sub reports, but I can't put it in the ROWS axis because
it is in the WHERE clause.

I've tried FILTER, but this is a much simplified example of what I
want, and I am worried FILTER will be slow. I do not own the cube but I
can request that changes be made to it.

Any help would be appreciated.


Reply With Quote
  #2  
Old   
wilb
 
Posts: n/a

Default Re: NEWBIE MDX WHERE how to parameterise - 09-13-2006 , 09:04 AM






I think I worked it out. I tried:-

SELECT
{[Measures].[Enrolments]}
ON COLUMNS,
([College].[College Id].[@PARAM], [College].[College Name].[College
Name])
ON ROWS
FROM
[ACube];

If all colleges are required, I swap .[@PARAM] with .Children. It seems
to work.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.