I have been looking all over stackoverflow for this and I can\'t figure it out. So I have a dataset using a SSAS cube, and it has two parameters. It has a category and subcate
As I said in comments you cannot use the Name of your member to slice your cube in MDX, you have to use the unique name instead. You have to handle it so when your user selects Category X
and Category Y
for your ParamCategory
parameter, it should be set to [Service].[Category].&[Category X]
and [Service].[Category].&[Category Y]
. This is what I'd do.
I'd use an MDX script that returns label (Name) and unique name for populate Category.
WITH MEMBER [Measures].[Category Label] AS
[Service].[Category].CurrentMember.Name
MEMBER [Measures].[Category UniqueName] AS
[Service].[Category].CurrentMember.UniqueName
SELECT
{ [Measures].[Category Label], [Measures].[Category UniqueName] } ON COLUMNS,
{} ON ROWS
FROM [Sales-Cube]
In parameter properties / available values you have to use Category Label
field for Label field
and Category UniqueName
for Value field
.
The same apprach to populate ParamSubcategory
.
WITH MEMBER [Measures].[SubCategory Label] AS
[Service].[SubCategory].CurrentMember.Name
MEMBER [Measures].[SubCategory UniqueName] AS
[Service].[SubCategory].CurrentMember.UniqueName
SELECT
{ [Measures].[SubCategory Label], [Measures].[SubCategory UniqueName] } ON COLUMNS,
{ [Service].[SubCategory].[SubCategory] } ON ROWS
FROM [Sales-Cube]
WHERE ( StrToSet ( @ParamCategory ) )
Note I am using ParamCategory
to populate the ParamSubcategory
only with the related subcategories.
Now you can use those parameters in your MDX script:
SELECT NON EMPTY { [Measures].[Sales Count] } ON COLUMNS,
NON EMPTY
{
( [Date].[Fiscal Year].[Fiscal Year].AllMembers )
} Dimension Properties MEMBER_CAPTION,
MEMBER_UNIQUE_NAME ON ROWS
FROM (
SELECT ( STRTOSET( @ParamSubcategory ) ) ON COLUMNS
FROM (
SELECT ( STRTOSET ( @ParamCategory ) ) ON COLUMNS
FROM [Sales-Cube]
)
) CELL Properties Value,
BACK_COLOR,
FORE_COLOR,
FORMATTED_VALUE,
FORMAT_STRING,
FONT_NAME,
FONT_SIZE,
FONT_FLAGS
Note Filter
and InStr
function are not requerid since you are passing the unique name members.
It is not tested but should work, good luck!
Let me know if this helps.