Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 MDX comma separated value in a column

Author  Topic 

varalakshmi
Yak Posting Veteran

98 Posts

Posted - 2013-07-31 : 02:30:52
Hi,

I have to show the top 10 dimension member based on a measure.
For example top customer by revenue.
In that case I have another dimension value, say the purchase location, which I should bring in the query with comma separated value.

example:

customer revenue purchase-location
cust1 10000$ city1,city2
How this should be handled in mdx query.

Please help me in resolving my issue.

Thanks in advance

- Varalakshmi

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-31 : 02:48:58
Without knowing your dimensions, measure involved etc its hard to suggest
Only hint we can give with info is to use GENERATE() function

something like

WITH MEMBER LocationList
AS
GENERATE(
[purchase-location dimensionname].[dimension field].MEMBERS,
[purchase-location dimensionname].[dimension field].CURRENTMEMBER.NAME, ",")

SELECT
LocationList ON 0,
[purchase-location dimensionname].[dimension field].MEMBERS ON 1
FROM CubeName

replace the dimension name and fields in above query accordingly

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

varalakshmi
Yak Posting Veteran

98 Posts

Posted - 2013-07-31 : 03:02:44
Thanks Visakh.
I tried this already but the issue is, I'm also using a topcount on rows to bring the top revenue records. but this generate part is bringing all the purchase-location irrespective of the customer.

- Varalakshmi
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-31 : 04:23:49
then create set first with topcount rows. Then apply generate over it to create the above member

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

varalakshmi
Yak Posting Veteran

98 Posts

Posted - 2013-07-31 : 06:04:48
I would like to ignore if it brings blank or null value. How should I do that?

- Varalakshmi
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2013-07-31 : 06:18:26
Use NONEMPTY()
Go to Top of Page
   

- Advertisement -