PerformancePoint过滤MDX查询或条件

时间:2015-03-12 20:20:26

标签: filter mdx performancepoint

我试图在PerformancePoint MDX查询过滤器中模仿此过滤器功能,然后将其连接到记分卡。

SELECT 
[Dim Status Month].[MONTHS].MEMBERS ON COLUMNS,

FILTER ([Dim Project].[LOB].MEMBERS,

    (
    strtomember('[Dim Project].[PM Login].&[' + CUSTOMDATA() + ']')
    or
    strtomember('[Dim Project].[TM Login].&[' + CUSTOMDATA() + ']')
    or
    strtomember('[Dim Project].[PAL Login].&[' + CUSTOMDATA() + ']')
    or
    strtomember('[Dim Project].[DO Login].&[' + CUSTOMDATA() + ']')
    or
    strtomember('[Dim Project].[ED Login].&[' + CUSTOMDATA() + ']')

    )
) ON ROWS
FROM [GLOBALDELIVERYREPORTING]

CustomerData()是当前用户名。

它适用于单一条件,例如:

strtomember('[Dim Project].[PAL Login].&[' + CUSTOMDATA() + ']')

我无法弄清楚使用多个条件的语法,即使它们在我直接针对多维数据集运行时工作正常。

所以,我在Filter的MDX Query窗口中删除了Filter Text Here,并从SQL分析器中获取了查询,这就是它最终看起来像:

WITH SET [7afbf0ad32e34820ab610fb5927a5f6e] AS HEAD({ StrToSet("Filter Text Here") }, 5001)
                        SELECT 
                        { 
                            IIF(COUNT([7afbf0ad32e34820ab610fb5927a5f6e])=0, { },
                            {(EXTRACT([7afbf0ad32e34820ab610fb5927a5f6e], [7afbf0ad32e34820ab610fb5927a5f6e](0)(0).Dimension) AS [7afbf0ad32e34820ab610fb5927a5f6eX]), 
                            (GENERATE(
                                [7afbf0ad32e34820ab610fb5927a5f6eX],
                                {
                                    { [7afbf0ad32e34820ab610fb5927a5f6eX].CURRENT.ITEM(0).PARENT, [7afbf0ad32e34820ab610fb5927a5f6eX].CURRENT.ITEM(0) }(0) 
                                }, 
                                ALL))})
                        }
                        DIMENSION PROPERTIES MEMBER_TYPE ON 0,
                        { } ON 1
                        FROM [GlobalDeliveryReporting]

1 个答案:

答案 0 :(得分:1)

是否允许您将过滤器移动到WHERE子句?

SELECT 
  [Dim Status Month].[MONTHS].MEMBERS ON COLUMNS,
  [Dim Project].[LOB].MEMBERS ON ROWS
FROM [GLOBALDELIVERYREPORTING]
WHERE
   (
    strtomember('[Dim Project].[PM Login].&[' + CUSTOMDATA() + ']')
    ,strtomember('[Dim Project].[TM Login].&[' + CUSTOMDATA() + ']')
    ,strtomember('[Dim Project].[PAL Login].&[' + CUSTOMDATA() + ']')
    ,strtomember('[Dim Project].[DO Login].&[' + CUSTOMDATA() + ']')
    ,strtomember('[Dim Project].[ED Login].&[' + CUSTOMDATA() + ']')
   );

尝试使用EXISTS功能:

SELECT 
  [Dim Status Month].[MONTHS].MEMBERS ON COLUMNS
 ,Exists
  (
    [Dim Project].[LOB].MEMBERS
   ,{
      StrToMember('[Dim Project].[PM Login].&[' + CustomData() + ']')
     ,StrToMember('[Dim Project].[TM Login].&[' + CustomData() + ']')
     ,StrToMember('[Dim Project].[PAL Login].&[' + CustomData() + ']')
     ,StrToMember('[Dim Project].[DO Login].&[' + CustomData() + ']')
     ,StrToMember('[Dim Project].[ED Login].&[' + CustomData() + ']')
    }
  ) ON ROWS
FROM [GLOBALDELIVERYREPORTING];

或者,如果您确定FILTER正在运行,请尝试嵌套您的过滤器:

SELECT 
  [Dim Status Month].[MONTHS].MEMBERS ON COLUMNS
 ,Filter
  (
    Filter
    (
      Filter
      (
        Filter
        (
          Filter
          (
            [Dim Project].[LOB].MEMBERS
           ,StrToMember('[Dim Project].[PM Login].&[' + CustomData() + ']')
          ),
         ,StrToMember('[Dim Project].[TM Login].&[' + CustomData() + ']')
        )
       ,StrToMember('[Dim Project].[PAL Login].&[' + CustomData() + ']')
      )
     ,StrToMember('[Dim Project].[DO Login].&[' + CustomData() + ']')
    )
   ,StrToMember('[Dim Project].[ED Login].&[' + CustomData() + ']')
  ) ON ROWS
FROM [GLOBALDELIVERYREPORTING];

也许您只需要一个简单的设置符号,如下所示:

{
  StrToMember('[Dim Project].[PM Login].&[' + CustomData() + ']')
 ,StrToMember('[Dim Project].[TM Login].&[' + CustomData() + ']')
 ,StrToMember('[Dim Project].[PAL Login].&[' + CustomData() + ']')
 ,StrToMember('[Dim Project].[DO Login].&[' + CustomData() + ']')
 ,StrToMember('[Dim Project].[ED Login].&[' + CustomData() + ']')
}