Filtering Members based on their names from the set(MDX)

  • Hi All. Can any one help me for this requirement:

    I have the Query:

    select [Measures].[Revision Number] on 0,

    [Dim Product].[Color].[Color].members on 1

    from [Adventure Works DW]

    The Result is:

    Revision Number

    Black9843

    Blue3970

    Grey(null)

    Multi3926

    NA28919

    Red4949

    Silver3424

    Silver/Black(null)

    White568

    Yellow4799

    Now I want to remove the members that name starting with 'B' and 'S". i.e. I want to remove the members Black,Blue, Silver & Silver/Black from the result.

    Thanks in advance...

  • Hope this helps:

    CREATE TABLE #Dw(Color VARCHAR(20),[Revision Number] INT)

    INSERT INTO #Dw

    SELECT 'Black', 9843 UNION ALL

    SELECT 'Blue', 3970 UNION ALL

    SELECT 'Grey', (null) UNION ALL

    SELECT 'Multi', 3926 UNION ALL

    SELECT 'NA', 28919 UNION ALL

    SELECT 'Red', 4949 UNION ALL

    SELECT 'Silver', 3424 UNION ALL

    SELECT 'Silver/Black', (null) UNION ALL

    SELECT 'White', 568 UNION ALL

    SELECT 'Yellow', 4799

    SELECT Color,[Revision Number] FROM #Dw WHERE Color NOT LIKE 'b%' AND Color NOT LIKE 's%'

    /*Results:

    ColorRevision Number

    GreyNULL

    Multi3926

    NA28919

    Red4949

    White568

    Yellow4799 */

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

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

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