0

我对 SSAS 多维数据集和术语(成员、层次结构等)和 MDX 查询完全陌生,但我已经开始了学习这些东西的旅程,所以如果我的问题很清楚,我深表歉意。

     SELECT NON EMPTY { } ON COLUMNS, { 
     [Suggestions].[Parent_id].[Parent_id] *--.ALLMEMBERS * 
     [Suggestions].[id].[id] * --.ALLMEMBERS * 
     [Suggestions].[Sugg - #].[Sugg - #] *-- .ALLMEMBERS * 
     [Suggestions].[Sugg - Assigned].[Sugg - Assigned] *  --.ALLMEMBERS * 
     [Suggestions].[Sugg - Assigned to].[Sugg - Assigned to]* --.ALLMEMBERS * 
     [Suggestions].[Sugg - Status].[Sugg - Status] *--.ALLMEMBERS   
    
     --[Parent_Details].[Unit_Name].[Unit_Name]  --.ALLMEMBERS
     } 
     DIMENSION PROPERTIES MEMBER_CAPTION, 
     MEMBER_UNIQUE_NAME ON ROWS 
     FROM ( SELECT ( { [Suggestions].[Sugg - Assigned to].&[UNIT] } ) ON COLUMNS 
     FROM ( SELECT ( STRTOSET('SG123', CONSTRAINED) ) ON COLUMNS 
     FROM ( SELECT ( { [Suggestions].[Sugg - Status].&[Pending Inputt] } ) ON COLUMNS 
     FROM [BOI_Tracker-Stats]))) 
     CELL PROPERTIES VALUE

我有上面执行的 MDX 查询。我从 SSMS 中的 MDX 查询设计器工具生成了查询,并且仅手动进行了简单的修改。

在查询中,如果我注释掉该行[Parent_Details].[Unit_Name].[Unit_Name] --.ALLMEMBERS,我会得到正确的行数。

主要问题。

如果我取消注释以返回Unit_Name列,则我的行将重复。原来的 100 行现在是正确的,因为数以千计的行都有重复值。任何人都知道我应该注意什么导致了这种情况。看起来正在应用错误的连接。

其他我想了解的事情。

1.查询设计器生成查询格式

[Suggestions].[Parent_id].[Parent_id].ALLMEMBERS * . 如果我注释掉.ALLMEMBERS *这样的查询只是[Suggestions].[Parent_id].[Parent_id]没有.ALLMEMBERS *结果是相同的。那么有什么用.ALLMEMBERS *

2.我还注意到我要选择的列重复了两次

Suggestions].[Parent_id].[Parent_id],为什么会这样?,为什么不能直接生成为Suggestions].[Parent_id]

4

1 回答 1

0

If you select from different dimensions like that you basically multiply the results. If you think about it that's the correct behavior. In your case you have [Suggestions] and [Parent_Details] . These are different dimensions. In your query you want results having both so it does:

For each member of [Suggestion] get all members of [Parent Details] and add them to the result. So the result set becomes:

[Suggestion-1][Parent_Details-1][Measures...]
[Suggestion-1][Parent_Details-2][Measures...]
[Suggestion-2][Parent_Details-1][Measures...]
[Suggestion-2][Parent_Details-2][Measures...]
[Suggestion-3][Parent_Details-1][Measures...]
etc.

( having different levels from the [Suggestions] dimension doesn't multiply the measures )

This is a correct behavior when you think about it because if you add these two dimensions you probably want to know something like "What are the measures for that suggestion and for these parent details?" And that exact row will be correct in the result set. It all depends on what result do you want to get (What do you ask for).

The multiplication of the names depends on your cube design. First row is a level and second a member. If you create a hierarchy for example it will not look like that.

于 2018-05-25T08:23:59.553 回答