开发者

Get names all currently available members

I have Action URL which will open web site from excel. I need to pass names of all employee which are currently listed in excel to that web site. This list is coming from cube and could be filter by user using many different measures. But after all there would available some [Employee].[Name].

开发者_运维技巧

So my question is how can I generate string with all employees names from current members . Below MDX how such list of employees could be receive from cube:

SELECT NON EMPTY {[Measures].[Salary]} ON COLUMNS, NON EMPTY {[Employee].[Name]} ON ROW FROM [Cube] WHERE ( [Employee].[Department].[X], [Employee].[Title].[Z] … … ) List of dimension in clause WHERE is unknown – it will depend what user will used in excel

Let assume that this MDX would return 5 names: A B C D E What I need to get for each row is the list all of this employees but only those currently display. So in above example the result should look like: A A,B,C,D,E B A,B,C,D,E C A,B,C,D,E D A,B,C,D,E E A,B,C,D,E

So then I could pass this in URL to web site

I’ve tried to do this using GENERATE with and without EXISTING but the result was that I either get list all employees from cube (not currently selected) or only one.

Can someone please help me with this?


You'll need a calculated member and us the generate mdx function (doc). The first idea would be :

MEMBER [Measures].[ListAsName] AS Generate( [Employee].[Name].members,  [Employee].[Name].currentmember.name, ", ")

The problem with this is that [Employee].[Name].members it's not filtered by the where clause (as it's the case with the axis). This is due to the fact it's in a calculated member context.

You've two possible solutions :

Use EXISTING. This implies we are certain that all members in the slicer are members of [Employee] dimension:

 MEMBER [Measures].[ListAsName] AS Generate( Existing [Employee].[Name].members,  [Employee].[Name].currentmember.name, ", ")

Use non empty:

 MEMBER [Measures].[ListAsName] AS Generate( nonempty([Employee].[Name].members),  [Employee].[Name].currentmember.name, ", ")

use both :-) -> nonempty( EXISTING [Employee].[Name].members )

The fact the first one is not working is or a bug of SSAS or a problem in your MDX query. The second one is a bit heavy but should work too. The third one is the bullet proof version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜