How to display multiple dimensions on rows in MDX query?

。_饼干妹妹 提交于 2021-02-17 05:32:26

问题


I have measure called Sales KG in my cube and two dimensions: Groups and Formats.

Is there anyway to display last ones in single row?

I have this query:

select
[Measures].[Sales KG] on Columns,
[Formats].[Format_TT].[Format_TT] on Rows
from [Model]

and it's working, but when I try to follow examples from Internet and turn it into:

select
[Measures].[Sales KG] on Columns,
{ ([Formats].[Format_TT].[Format_TT]), ([Groups].[Group_Name].[Group_Name]) } on Rows
from [Model]

Everything ends with error saying that Elements, tuples and sets in functions must use same hierarchy.

I am new to MDX. I don't know why it works for others and no work for me. 3 days ago I didn't even knew about it's existence.


回答1:


It is giving you the above error because you are breaking dimensionality and hierarchility. When you write

 { ([Formats].[Format_TT].[Format_TT]),
 ([Groups].[Group_Name].[Group_Name]) }

MDX translates that you have a set (marked by {}), containing two tuples ([Formats].[Format_TT].[Format_TT]),([Groups].[Group_Name].[Group_Name]), marked by "()" each. Now the issue is all the tuple in a SET must contain then same hierarchies(The principle of hierarchility), plus they should be in the same order (Dimensionality)

select
[Measures].[Sales KG] on Columns,
{ ([Formats].[Format_TT].[Format_TT], [Groups].[Group_Name].[Group_Name]) } on Rows
from [Model]


来源:https://stackoverflow.com/questions/54692910/how-to-display-multiple-dimensions-on-rows-in-mdx-query

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