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


MDX Query where value is greater than


MDX Query where value is greater than

Author
Message
Jeffrey Irish
Jeffrey Irish
Old Hand
Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)Old Hand (316 reputation)

Group: General Forum Members
Points: 316 Visits: 1144
I'm a newb to MDX queries and I am just getting started with the concepts. I know that I am supposed to forget what I know about SQL since the structure of MDX is completely different.

To that end, I'm trying to run a pretty simple query, but I'm kind of hung up on the concept of a WHERE clause and Tuples. I get the data on the intersection of the cube, but then I want to limit it to a specific value for one member in one of the measures.

Here's my query:
SELECT 
{[PC].[Code].Members } on columns,
{[EE].[Em].members} on rows
from
[Cube]
where
([PC].[Code].&[Reg1]) > 200



If I get rid of the WHERE the query runs, but I see all of the data. In this case, I only want to see where there is a value of 200 or greater for Reg1. All of the members would show, but only when the WHERE condition was met.

I hope I'm giving enough information. w00t

Regards,

Irish w00t
PB_BI
PB_BI
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1975 Visits: 2518
What you have to have in mind about the WHERE clause in MDX is that in it you are supplying the context for the query (I think originally it was CONTEXT rather than WHERE). So it's not like the SQL WHERE something IS something.

With that in mind have a look into the FILTER function and you should be able to achieve what you need to.

http://technet.microsoft.com/en-us/library/ms146037.aspx

I could write the query for you but I think it stays with you better if you learn it yourself :-D

Best of luck.




I'm on LinkedIn
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