0
votes

I want to tuple using member key of [Dim].[Country]

{[Dim].[Country].CurrentMember.Member_Key},
STRTOSET("[User].[ID].&[" + mid(username, instr(username, "\")+1) + "]")

But when I use CurrentMember.Member_Key function I get the following error: The function expects a tuple set expression for the 1 argument. A string or numeric expression was used.

If I write it like this using "members" is works. But then it will tuple with the full name (100 - Norway) but my goal is to tuple it with just the key part e.g "100"

{[Dim].[Country].members},
STRTOSET("[User].[ID].&[" + mid(username, instr(username, "\")+1) + "]")

Best regards, Rubrix

1

1 Answers

0
votes

Instead of [Dim].[Country].CurrentMember.Member_Key you should do something like this:

with member [Measures].CountryKey as [Dim].[Country].CurrentMember.Member_Key

So something like this could work (on Adventure Works):

with member [Measures].CountryKey as [Geography].[Country].CurrentMember.Member_Key
SELECT ([Measures].CountryKey, StrToSet ('[Geography].[State-Province].Members')  )
ON 0  
FROM [Adventure Works]