dbTalk Databases Forums  

How to Concatenate in MDX

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss How to Concatenate in MDX in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lawrence
 
Posts: n/a

Default How to Concatenate in MDX - 03-07-2006 , 01:06 PM






Hello MDX experts,

I have a question regarding concetenation of a string within MDX. You will
see 5 products below, but I am trying to add "TestProduct" string to each of
the Product members below on the Rows (ie AWC Logo Cap - TestProduct). The
commented lines are the ones giving me trouble.

WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
//'{ [Product].[Product].Children + StrToMember("- TestProduct") }'
//'{ MemberToStr([Product].[Product].CurrentMember) }'
SELECT
topcount([ChardonnayChablis],5,[Measures].[Order Count]) ON Rows,
[Measures].[Order Count] ON Columns
FROM [Adventure Works]

Sincerely,
-Lawrence


Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: How to Concatenate in MDX - 03-07-2006 , 02:58 PM






You can't alter the member names in this way. What you could do is to
create a calculated measure to display the text you are after. Which is
probably only suitable if you are feeding the results into a reporting
tool of some sort like Reporting Services.

Although you could also use the calculated measure to only return
"TestProduct" under certain situations and if you made this measure the
first column in the query, it would sit right next to the member name.


WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
MEMBER Measures.ProdLabel as '{ [Product].
[Product].CurrentMember.Name "- TestProduct"'

SELECT
topcount([ChardonnayChablis],5,[Measures].[Order Count]) ON Rows,
{[Measures].ProdLabel,[Measures].[Order Count]} ON Columns
FROM [Adventure Works]

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <F54B2C60-E96D-4E0E-AAE2-E2FEBB99AADB (AT) microsoft (DOT) com>,
Lawrence (AT) discussions (DOT) microsoft.com says...
Quote:
Hello MDX experts,

I have a question regarding concetenation of a string within MDX. You will
see 5 products below, but I am trying to add "TestProduct" string to each of
the Product members below on the Rows (ie AWC Logo Cap - TestProduct). The
commented lines are the ones giving me trouble.

WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
//'{ [Product].[Product].Children + StrToMember("- TestProduct") }'
//'{ MemberToStr([Product].[Product].CurrentMember) }'
SELECT
topcount([ChardonnayChablis],5,[Measures].[Order Count]) ON Rows,
[Measures].[Order Count] ON Columns
FROM [Adventure Works]

Sincerely,
-Lawrence



Reply With Quote
  #3  
Old   
Lawrence
 
Posts: n/a

Default Re: How to Concatenate in MDX - 03-07-2006 , 04:46 PM



So there's no way to concatenate two members into one? I am trying to
combine two members and store as one in a filter box for user to select on,
if you know what I am saying.
I guess I am out of luck, and would resort to create another dimension with
the data combined.

Let me know if there's a workaround,
Appreciate it!
-Lawrence


"Darren Gosbell" wrote:

Quote:
You can't alter the member names in this way. What you could do is to
create a calculated measure to display the text you are after. Which is
probably only suitable if you are feeding the results into a reporting
tool of some sort like Reporting Services.

Although you could also use the calculated measure to only return
"TestProduct" under certain situations and if you made this measure the
first column in the query, it would sit right next to the member name.


WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
MEMBER Measures.ProdLabel as '{ [Product].
[Product].CurrentMember.Name "- TestProduct"'

SELECT
topcount([ChardonnayChablis],5,[Measures].[Order Count]) ON Rows,
{[Measures].ProdLabel,[Measures].[Order Count]} ON Columns
FROM [Adventure Works]

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <F54B2C60-E96D-4E0E-AAE2-E2FEBB99AADB (AT) microsoft (DOT) com>,
Lawrence (AT) discussions (DOT) microsoft.com says...
Hello MDX experts,

I have a question regarding concetenation of a string within MDX. You will
see 5 products below, but I am trying to add "TestProduct" string to each of
the Product members below on the Rows (ie AWC Logo Cap - TestProduct). The
commented lines are the ones giving me trouble.

WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
//'{ [Product].[Product].Children + StrToMember("- TestProduct") }'
//'{ MemberToStr([Product].[Product].CurrentMember) }'
SELECT
topcount([ChardonnayChablis],5,[Measures].[Order Count]) ON Rows,
[Measures].[Order Count] ON Columns
FROM [Adventure Works]

Sincerely,
-Lawrence




Reply With Quote
  #4  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: How to Concatenate in MDX - 03-08-2006 , 04:29 AM



What sort of application do you want to perform the filtering in. I know
of a couple of techniques that we could get to work in Reporting
Services.

You can do things like create a couple of calculated measures in the
query used to populate the parameter values, one with the details for
the filter and one with the label for the filter. Then you use an
expression to build the MDX Query, concatenating the filter value onto
the rest of the query.

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <89EC073A-0B0D-4C7B-ACB8-B7E9D21809F8 (AT) microsoft (DOT) com>,
Lawrence (AT) discussions (DOT) microsoft.com says...
Quote:
So there's no way to concatenate two members into one? I am trying to
combine two members and store as one in a filter box for user to select on,
if you know what I am saying.
I guess I am out of luck, and would resort to create another dimension with
the data combined.

Let me know if there's a workaround,
Appreciate it!
-Lawrence


"Darren Gosbell" wrote:

You can't alter the member names in this way. What you could do is to
create a calculated measure to display the text you are after. Which is
probably only suitable if you are feeding the results into a reporting
tool of some sort like Reporting Services.

Although you could also use the calculated measure to only return
"TestProduct" under certain situations and if you made this measure the
first column in the query, it would sit right next to the member name.


WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
MEMBER Measures.ProdLabel as '{ [Product].
[Product].CurrentMember.Name "- TestProduct"'

SELECT
topcount([ChardonnayChablis],5,[Measures].[Order Count]) ON Rows,
{[Measures].ProdLabel,[Measures].[Order Count]} ON Columns
FROM [Adventure Works]

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <F54B2C60-E96D-4E0E-AAE2-E2FEBB99AADB (AT) microsoft (DOT) com>,
Lawrence (AT) discussions (DOT) microsoft.com says...
Hello MDX experts,

I have a question regarding concetenation of a string within MDX. You will
see 5 products below, but I am trying to add "TestProduct" string to each of
the Product members below on the Rows (ie AWC Logo Cap - TestProduct). The
commented lines are the ones giving me trouble.

WITH SET [ChardonnayChablis] AS
'{ [Product].[Product].Children }'
//'{ [Product].[Product].Children + StrToMember("- TestProduct") }'

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.