本文介绍了MDX-需要3rd +尺寸示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习MDX.我是一位经验丰富的SQL开发人员.

I am trying to learn MDX. I am an experienced SQL Developer.

我正在尝试查找具有两个以上维度的MDX查询的示例.每个谈论MDX的网页都提供了简单的二维示例,将其链接:

I am trying to find an example of an MDX query that has more than two dimensions. Every single webpage that talks about MDX provides simple two dimensional examples link this:

select
{[Measures].[Sales Amount]} on columns,
Customer.fullname.members on rows
from [Adventure Works DW2012]

我正在寻找使用以下别名的示例:PAGES(第三维?),section(第四维?)和Chapter(第五维?).我已经尝试过了,但是我认为这是不正确的:

I am looking for examples that use the following aliases: PAGES (third dimension?), section (forth dimension?) and Chapter (fifth dimension?). I have tried this but I do not think it is correct:

select
{[Measures].[Sales Amount]} on columns,
Customer.fullname.members on rows,
customer.Location.[Customer Geography] as pages
from [Adventure Works DW2012]

我正在尝试使用MDX查询(来自AdventureWorks DW2012)获得此输出:

I am trying to get this output using an MDX query (this is from AdventureWorks DW2012):

推荐答案

除非您裁剪了其中的内容,否则该屏幕截图中不是3维结果集.

That's not a 3-dimensional resultset in your screenshot, unless there's something cropped from it.

类似

SELECT [Geography].[Country].Members ON 0,
[Customer].[CustomerName].Members ON 1
FROM [whatever the cube is called]
WHERE [Measures].[Sales Amount]

(维度/层次结构/级别名称可能不完全正确)会得到一个与您的消息中的结果类似的结果集.

(dimension/hierarchy/level names may not be exactly right)would give a resultset like the one in your message.

我知道的任何客户端工具中都没有使用第二维以外的尺寸和尺寸名称. (其他人可能知道不同).它们似乎存在于MDX中,因此MDX可以将2维以上的结果集传递给可以处理它们的客户端(例如,将其结果传递给主查询的MDX子查询).

The beyond 2nd-dimension dimensions and dimension names are not used in any client tool that I know. (Others may know different). They seem to be there in MDX so that MDX can hand >2-dimensional resultsets to clients that can handle them (e.g. an MDX subquery handing its results to the main query).

MDX中经常使用的技巧是通过交叉连接将二维的成员放到一个轴上.

An often-used trick in MDX is to get the members of two dimensions onto one axis by cross-joining:

选择{[Date].[Calendar Date].[Calendar Year] .Members * [Geography].[Country] .Members} ON 0,[其他] ON 1从[多维数据集]

SELECT{[Date].[Calendar Date].[Calendar Year].Members * [Geography].[Country].Members} ON 0,[something else] ON 1FROM [Cube]

这篇关于MDX-需要3rd +尺寸示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 22:17