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


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


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

Author
Message
ch.ds19
ch.ds19
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 132
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
Black 9843
Blue 3970
Grey (null)
Multi 3926
NA 28919
Red 4949
Silver 3424
Silver/Black (null)
White 568
Yellow 4799

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...
bitbucket-25253
bitbucket-25253
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16547 Visits: 25280
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:
Color Revision Number
Grey NULL
Multi 3926
NA 28919
Red 4949
White 568
Yellow 4799 */



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

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
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