dbTalk Databases Forums  

Help Required in building MDX Query

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


Discuss Help Required in building MDX Query in the microsoft.public.sqlserver.olap forum.



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

Default Help Required in building MDX Query - 06-05-2004 , 03:46 AM






Hi

I am a newbie for AS2K and MDX. I am facing trouble in making MDX
query, in which I have to set filter on the members of dimensions,
which are existing on the axes also.

I am working with Medical Insurance Claims data. One of the dimension,
say Physician, is having the 2 Levels. Specialty>Physician. Specialty
may have values like cardiology, neurology, physician etc. Physician
is keeping the Physicians' names. LIke it I have 8 more dimensions, 4
of which are having 3 levels.

We have to provide the UI in which user can filter the data. First
user will select one or more Dimension Level(s)(displayed in a
Listbox) and in next step he/she will select the Members of that
levels (displayed in a Listbox), to specify the results filtered upon.
The MDX is required to be generated on the fly, as per filter
criteria.

An SQL equivalant for this may be

SELECT Speciality, Physican, Cost, Insurance_Co
FROM Table
WHERE Physician in (Phy1, Phy2) AND
Specilty IN (Cardiology, Urology) AND
Insurance_Co IN (TUFTS, BCBS) AND
Year = 2004


But when I try to implement like this in MDX, it gives me error
'Duplicate dimensions across (independant) axes - when calculating a
query axis.'

My problem is that we have a fixed SELECT caluse for MDX, and we have
to show the data according to the filter applied.

I will be grateful for any help in this regard.

Thanks in anticipation

Vivek

Reply With Quote
  #2  
Old   
Martin Mason
 
Posts: n/a

Default Re: Help Required in building MDX Query - 06-05-2004 , 11:15 PM






Your WHERE clause needs to be a single tuple referencing only a single
member in each of your dimensions. However, what I think you're trying to
do is something on the order of the following:

SELECT { [Time].[2004] } ON COLUMNS,
NonEmptyCrossJoin( { [Physician].[Phy1],
[Physician].[Phy2] }, { [Insurance_Co].[TUFTS], [Insurance_Co].[BCBS] }) ON
ROWS
FROM Cube



SELECT Speciality, Physican, Cost, Insurance_Co
Quote:
FROM Table
WHERE Physician in (Phy1, Phy2) AND
Specilty IN (Cardiology, Urology) AND
Insurance_Co IN (TUFTS, BCBS) AND
Year = 2004
"Vivek" <vivekmca (AT) yahoo (DOT) com> wrote

Quote:
Hi

I am a newbie for AS2K and MDX. I am facing trouble in making MDX
query, in which I have to set filter on the members of dimensions,
which are existing on the axes also.

I am working with Medical Insurance Claims data. One of the dimension,
say Physician, is having the 2 Levels. Specialty>Physician. Specialty
may have values like cardiology, neurology, physician etc. Physician
is keeping the Physicians' names. LIke it I have 8 more dimensions, 4
of which are having 3 levels.

We have to provide the UI in which user can filter the data. First
user will select one or more Dimension Level(s)(displayed in a
Listbox) and in next step he/she will select the Members of that
levels (displayed in a Listbox), to specify the results filtered upon.
The MDX is required to be generated on the fly, as per filter
criteria.

An SQL equivalant for this may be

SELECT Speciality, Physican, Cost, Insurance_Co
FROM Table
WHERE Physician in (Phy1, Phy2) AND
Specilty IN (Cardiology, Urology) AND
Insurance_Co IN (TUFTS, BCBS) AND
Year = 2004


But when I try to implement like this in MDX, it gives me error
'Duplicate dimensions across (independant) axes - when calculating a
query axis.'

My problem is that we have a fixed SELECT caluse for MDX, and we have
to show the data according to the filter applied.

I will be grateful for any help in this regard.

Thanks in anticipation

Vivek



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.