MDX(SSRS)参数子集

时间:2016-11-01 11:10:04

标签: reporting-services parameters mdx

我需要在MDX中对我的SSRS参数代码提供一些帮助 的上下文 我试图返回国家/地区位置,并输入=物品和房屋数量(不用作参数) 对于下拉列表 我使用了标题,uniqueName和level.ordinal方法

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];

这不会归还我在

后的内容

enter image description here

我应该只显示一个位置列表,只有在与类型=事项交叉并且有房屋数量的地方 我在调整代码时要么获取所有位置,要么显示表格的值

2 个答案:

答案 0 :(得分:1)

您可能需要将[Country].[Location]移到上下文中并输入WHERE子句?

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];

答案 1 :(得分:0)

您的查询中没有过滤,因为它当前已写入。要实现您所声明的内容(仅在Typematter的情况下返回),只需在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];