MDX - filter out tuple set

  • I am trying to filter out some tuples in an mdx query and I can't figure out an easy way to do it.

    e.g.

    select

    {} on 0,

    [Product].[Product Categories] on 1

    from [adventure works]

    WHERE not [Product].[Product Categories].[Gloves]

    or

    select

    {} on 0,

    Filter([Product].[Product Categories],[Product].[Product Categories] <> [Gloves]) on 1

    from [adventure works]

    I know the above is not syntatically correct, just trying to explain what I am trying to acheive.

    Also, I don't have AW on this computer, so sorry if I'm mixing dimensions.

    I'm new to MDX...

    Any help is appreciated.

    Thanks, Megan

  • You can look at utilizing the Except (MDX) function. It will look like this:

    select

    {} on 0,

    Except([Product].[Product Categories].members,

    {[Product].[Product Categories].[Gloves]}) on 1

    from [adventure works]

    ----------------------------------------------------------------------------------------
    Dan English - http://denglishbi.wordpress.com

  • OMG! I glanced right over that function. THANK YOU.

    -M

  • You can also use this syntax - (Except) (MDX).

    Which would look like this from BOL:

    // This query shows the quantity of orders for all product categories

    // with the exception of Components.

    SELECT

    [Measures].[Order Quantity] ON COLUMNS,

    [Product].[Product Categories].[All].Children

    - [Product].[Product Categories].[Components] ON ROWS

    FROM

    [Adventure Works]

    ----------------------------------------------------------------------------------------
    Dan English - http://denglishbi.wordpress.com

  • cool! thanks!

  • Hi Megan! To exclude Gloves, you'd typically remove that member from the set using a function like Except. You're thinking in the right direction—filtering out items you don’t need helps focus your analysis, and in this case, leaving out Gloves makes sense if they're not relevant to what you're reviewing.

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

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