Applying AND in MDX

  • hi...can anyone help with applying the "AND" operator in the WHERE clause of an MDX query?when i tried to do that,it gave me the error ," An error occurred while execuiting the query. Formula Error-Cannot convert expresion to operator - in an <operator> functuon"

    i cant believe that its not possible to apply it in MDX but even if its so,plz tell me the way around it...i need to check different criteria in different dimensions before the query displays the results... thanx

  • Hi,

    I'm so sorry that I can't understand what's kind of " AND " operator is you want?

    Could you post MDX syntax on the board?

    Maybe could give you some advices?

    Thanks!

    Angi

  • Hey Wajih,

    THe 'WHERE' is a little different in MDX when compared to the of TSQL.  You need a tuple in the where clause, so based on what you've posted so far, if you're looking to filter to a singl member from one or more dimensions, this can be done by creating a tuple within round '(' brackets.  I've psoted a simple sample below.

    SELECT

     {[Customers].CHILDREN} ON 1,

     {[Gender].Members} ON 0

    FROM [Sales]

    WHERE

    ([Product].[All Products].[Drink], [Store].[All Stores].[USA].[CA])

    This basically filters the customers an gender values (they're using the default measure, which i think is store sales) to only the 'Drink' product group and only those stores in California (CA).  So this is using a single member from two different dimensions, so basic syntax is ( <dim1>.member, .....,<dimn>.member)

    If you want o use more than one member from a dimension (say you wanted to filter to food and drink) thn you'll ned to create a calculated member and then use thta in he where clause.

    NB If you're using AS2K5 then you could/can use sub-queries to limit the data, a neat feature.

    HTH,

     

    Steve.

  • thnax

Viewing 4 posts - 1 through 3 (of 3 total)

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