MDX (SSRS) Parameter subset

喜你入骨 提交于 2019-12-25 08:19:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!