SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 MDX comma separated value in a column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

varalakshmi
Yak Posting Veteran

India
96 Posts

Posted - 07/31/2013 :  02:30:52  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 07/31/2013 :  02:48:58  Show Profile  Reply with Quote
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

India
96 Posts

Posted - 07/31/2013 :  03:02:44  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 07/31/2013 :  04:23:49  Show Profile  Reply with Quote
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

India
96 Posts

Posted - 07/31/2013 :  06:04:48  Show Profile  Reply with Quote
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

United Kingdom
3608 Posts

Posted - 07/31/2013 :  06:18:26  Show Profile  Reply with Quote
Use NONEMPTY()
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.19 seconds. Powered By: Snitz Forums 2000