简体   繁体   English

MDX计算的成员不允许使用多个层次结构元组

[英]MDX calculated Member not allowed multiple hierarchy tuple

I've using a sql Table to generate filters on each dimensions for a value in a SSAS Cube. 我使用sql表在SSAS多维数据集中的值的每个维度上生成过滤器。

SQL表

The MDX Query is based on the column Query below, the calculated member is: MDX查询基于下面的查询列,计算得出的成员是:

   AGGREGATE
    (
      IIF(Query= "" or ISEMPTY(Query),
           [Code].[_KeyQuery].[ALL],
           StrToTuple('('+ Query+')')
           ),[Measures].[Value]
    )

I have to work with pivot Table in Excel. 我必须在Excel中使用数据透视表。 It works perfectly, the value is correctly filter on each dimension member. 它运行完美,该值已在每个维成员上正确过滤。 If i use a query like this, it's ok. 如果我使用这样的查询,就可以了。

[Level].[LevelCode].&[A],[Status].[StatusCode].&[ST]

But now i need adding the possibility to filter on multiple dimensions members. 但是现在我需要添加对多个维度成员进行过滤的可能性。 For exemple, using a query : 例如,使用查询:

[Level].[LevelCode].&[A],[Level].[LevelCode].&[X],[Status].[StatusCode].&[ST]

It doesn't works, i've try changing the query like this: 它不起作用,我尝试像这样更改查询:

{[Level].[LevelCode].&[A],[Level].[LevelCode].&[X]},[Status].[StatusCode].&[ST]

but the StrToTuple() function causes error. 但是StrToTuple()函数会导致错误。 I don't know how to filter in multiple values for a same dimension hierarchy. 我不知道如何为同一个维度层次结构过滤多个值。

If it will always be a tuple then no need to use AGGREGATE just a tuple should return the value: 如果它将始终是一个元组,则无需使用AGGREGATE,只需一个元组应返回值:

  IIF(
    Query= "" OR ISEMPTY(Query),
    (
      [Code].[_KeyQuery].[ALL]
     ,[Measures].[Value]
    )
   ,StrToTuple('('+ Query +',[Measures].[Value])')
  )

Or this version: 或此版本:

   StrToTuple(
      '('
      + IIF(
          Query= "" OR ISEMPTY(Query)
         ,[Code].[_KeyQuery].[ALL]
         ,Query 
       )
     +',[Measures].[Value])'
    )

possible approach for decision between tuple and set 元组和集合之间可能的决策方法

Add a column to your control table "TupleOrSet" with values of either "T" or "S". 向您的控制表“ TupleOrSet”添加一列,其值为“ T”或“ S”。 Then you could amend your code to something like this: 然后,您可以将代码修改为以下内容:

  IIF(
    Query= "" OR ISEMPTY(Query),
    (
      [Code].[_KeyQuery].[ALL]
     ,[Measures].[Value]
    )
   ,IIF(
       TupleOrSet = "T"
      ,StrToTuple('('+ Query +',[Measures].[Value])')
      ,AGGREGATE( StrToSet('{'+ Query +'}'), [Measures].[Value])
    )
  )

note 注意

A tuple is a definite point in the cube space so cannot therefore be made up of two members from the same hierarchy - this would create coordinates that are non-determinant 元组是多维数据集空间中的一个确定点,因此不能由同一层次结构中的两个成员组成-这将创建不确定的坐标

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM