MDX Query where value is greater than

  • 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 

  • 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 😀

    Best of luck.


    I'm on LinkedIn

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply