帮助理解 OLAP MDX 查询

发布于 2024-10-10 19:46:51 字数 1048 浏览 4 评论 0原文

我一直在尝试学习 SSAS Cubes 和 MDX。到目前为止,我已经成功创建了一个多维数据集,当通过多维数据集浏览器查看时,该多维数据集返回正确的数据/计算。

查询生成器用于在报告服务中构建查询来查询多维数据集,我查看了生成的 MDX,并提取了似乎对实际结果没有影响的内容。查询如下所示:

SELECT NON EMPTY { [Measures].[AverageConnectedSeconds] } ON COLUMNS,    
NON EMPTY { ([Operator].[ACCESS DEF].[ACCESS DEF].ALLMEMBERS * [Calls].[Notification Time Bands].[Notification Time Bands].ALLMEMBERS) } ON ROWS    
FROM ( SELECT ( -{ [Calls].[Notification Time Bands].&[0] } ) ON COLUMNS    
FROM ( SELECT ( { [Calls].[Incoming YN].[N] } ) ON COLUMNS    
FROM ( SELECT ( -{ [Calls].[Entity Type].&[6] } ) ON COLUMNS   
FROM ( SELECT ( -{ [Calls].[Reason Text].&[Background Call] } ) ON COLUMNS    
FROM ( SELECT ( { STRTOMEMBER(@OperatorId) } ) ON COLUMNS   
FROM [PNC5data] )))))

我已经阅读了语法,并且我思考我理解为什么查询要进行嵌套选择。 我是否正确理解嵌套的 SELECT FROM 充当 SQL 中的 WHERE 子句?

如果是这样: MDX 中的 WHERE 子句用于什么以及何时/为什么要使用它?

如果有人能够给我详细说明此查询中实际发生的情况,我将非常感激!或者,如果您能够指导我找到可以进一步加深我对 MDX 的理解的资源,我将不胜感激!

谢谢,

詹姆斯

I've been trying to learn SSAS Cubes and MDX. So far I have managed to create a cube that returns the correct data/calculations when viewed through the cube browser.

The Query Builder was used to build a query in reporting services to query the cube, I've looked at the MDX this generated and pulled out the stuff that doesn't seem to make a difference to the actual results. The query looks like this:

SELECT NON EMPTY { [Measures].[AverageConnectedSeconds] } ON COLUMNS,    
NON EMPTY { ([Operator].[ACCESS DEF].[ACCESS DEF].ALLMEMBERS * [Calls].[Notification Time Bands].[Notification Time Bands].ALLMEMBERS) } ON ROWS    
FROM ( SELECT ( -{ [Calls].[Notification Time Bands].&[0] } ) ON COLUMNS    
FROM ( SELECT ( { [Calls].[Incoming YN].[N] } ) ON COLUMNS    
FROM ( SELECT ( -{ [Calls].[Entity Type].&[6] } ) ON COLUMNS   
FROM ( SELECT ( -{ [Calls].[Reason Text].&[Background Call] } ) ON COLUMNS    
FROM ( SELECT ( { STRTOMEMBER(@OperatorId) } ) ON COLUMNS   
FROM [PNC5data] )))))

I've read up on the Syntax and I THINK I understand why the query is doing nested selects.
Am I right in understanding that the nested SELECT FROM's are acting as a WHERE clause would in SQL?

If so: What is the WHERE clause used for in MDX and when/why would I use one?

If anyone is able to give me a breakdown of what is actually happening in this query I'd really appreciate it! Or if you're able to direct me to a resource I could further my understanding of MDX, I'd be greatful!

Thanks,

James

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ι不睡觉的鱼゛ 2024-10-17 19:46:51

理解 WHERE 子句很简单。您会在许多来源中看到人们抱怨其误导性名称。更好的名称是切片器。通过使用 where 子句,您可以查询多维数据集的切片而不是整个多维数据集(显然,当您查询切片而不是整个多维数据集时,您将获得一些性能提升)。

FROM 子句用于查询多维数据集查询另一个MDX 查询(即子查询)。子查询通常速度较慢,但​​也更强大。例如,当您使用层次结构作为切片器时,您不能在轴中使用它,而使用子查询则可以,例如子查询可以更改层次结构的结构。

在上面的语句中您会看到嵌套子查询。如果您了解一些 MDX 语法,则很容易打破和解释每个子查询,甚至将一些子查询移动到切片器。

我对整个 OLAP 主题也比较陌生。我一直在使用的两个来源是: icCube MDX 参考(我我不是 Microsoft 粉丝,icCube 是一个很好、易于使用的替代方案)和 快速通道MDX。我特别喜欢 MDX 快速通道,因为它对基本 MDX 功能和术语(如集合、元组、函数等)的解释很容易理解,特别是如果您使用 Microsoft BI 工具。您可能想看看这篇文章也。

Understanding WHERE clause is straightforward. You will see in many sources that people complain about its misleading name. The better name to use is Slicer. By using a where clause you are able to query a slice of a cube instead of the whole cube (obviously you will have some performance gains when you query a slice instead of a whole cube).

FROM clause is used to query a cube or to query another MDX query i.e. subqueries. Subqueries are generally slower but are more powerful too. e.g. when you use a hierarchy as a slicer you cannot use it in an axis while with a subquery you can e.g. subqueries can change the hierarchies' structure.

In the above statement you see nested subqueries. If you know some MDX syntax it is easy to break and interpret each subquery or even move some to the slicer.

I am relatively new to the whole OLAP subject too. The two sources I have been using are: icCube MDX reference (I am not a Microsoft fan, icCube was a good, easy to use alternative) and Fast Track to MDX. I specially like Fast track to MDX because its explanation of essential MDX features and the terminology (like set, tuple, function, etc) is easy to follow, specially if you are using Microsoft BI tools. You may want to take a look at this post too.

初心 2024-10-17 19:46:51

我之前发布了 MDX 介绍的链接,很受欢迎,但这篇文章中还有许多其他很好的资源。
the-best-mdx-references-on-the-net< /a>

I posted a link to my MDX introduction before and it was well received, but there are many other good resources in this posting.
the-best-mdx-references-on-the-net

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文