问题
I need a bit of help with my SSRS parameter code in MDX context I'm trying to return Country locations with and type = matter and a house count (not used as a parameter) for the drop down list I'm using the caption, uniqueName and level.ordinal method
WITH MEMBER [Measures].[ParameterCaption] AS
[Country].[Location].CurrentMember.Member_Caption
MEMBER [Measures].[ParameterCaption2] AS
[Type].[Type].CurrentMember.Member_Caption
MEMBER [Measures].[ParameterValue] AS
[Country].[Location].CurrentMember.UniqueName
MEMBER [Measures].[ParameterLevel] AS
[Country].[Location].CurrentMember.Level.Ordinal
SELECT
{ [Measures].[HouseCount]
, [Measures].[ParameterCaption]
,[Measures].[ParameterValue]
,[Measures].[ParameterLevel]}ON COLUMNS
, ([Type].[Type].ALLmembers )ON ROWS
FROM [Cube];
this doesn't return what I'm after
I should be shown a list of locations only where they are crossed with a type =matter and has a House count I when I tweak the code either get all location or what is show table the value of
回答1:
You might need to move [Country].[Location] into context and type into a WHERE clause?
WITH MEMBER [Measures].[ParameterCaption] AS
[Country].[Location].CurrentMember.Member_Caption
MEMBER [Measures].[ParameterCaption2] AS
[Type].[Type].CurrentMember.Member_Caption
MEMBER [Measures].[ParameterValue] AS
[Country].[Location].CurrentMember.UniqueName
MEMBER [Measures].[ParameterLevel] AS
[Country].[Location].CurrentMember.Level.Ordinal
SELECT
{
[Measures].[HouseCount],
[Measures].[ParameterCaption],
[Measures].[ParameterValue],
[Measures].[ParameterLevel]
} ON COLUMNS,
NonEmpty(
[Country].[Location].[Location].MEMBERS
,[Measures].[HouseCount]
) ON ROWS
FROM [Cube]
WHERE [Type].[Type].[matter];
回答2:
You have no filtering in your query as it is currently written. To achieve what you state (only return where Type is matter) then simply select only that Type on the ROWS.
WITH MEMBER [Measures].[ParameterCaption] AS
[Country].[Location].CurrentMember.Member_Caption
MEMBER [Measures].[ParameterCaption2] AS
[Type].[Type].CurrentMember.Member_Caption
MEMBER [Measures].[ParameterValue] AS
[Country].[Location].CurrentMember.UniqueName
MEMBER [Measures].[ParameterLevel] AS
[Country].[Location].CurrentMember.Level.Ordinal
SELECT
{
[Measures].[HouseCount],
[Measures].[ParameterCaption],
[Measures].[ParameterValue],
[Measures].[ParameterLevel]
} ON COLUMNS,
( [Type].[Type].[matter] ) ON ROWS
FROM [Cube];
来源:https://stackoverflow.com/questions/40358880/mdx-ssrs-parameter-subset