在报告服务中使用过滤器构建分析服务查询 (MDX)
我在报告服务中构建MDX查询问题。我已经通过Internet进行了很多搜索,尽管有明确的MDX查询示例以及如何构建它,但我一直都会遇到语法错误。因此,这是事实:
我想做的很简单。我想过滤数据,仅包括在相应的列和参数中具有相等值的行。查询构建器生成的原始查询是:
SELECT NON EMPTY { [Measures].[Value] } ON COLUMNS,
NON EMPTY {
([Net Object Hierarchy].[Central Telecom Center].[Central Telecom Center].ALLMEMBERS *
[Net Object Hierarchy].[Province].[Province].ALLMEMBERS *
[Net Object Hierarchy].[County].[County].ALLMEMBERS *
[Net Object Hierarchy].[District].[District].ALLMEMBERS *
[Net Object Hierarchy].[Rural].[Rural].ALLMEMBERS *
[Net Object Hierarchy].[Village].[Village].ALLMEMBERS *
[Net Object Hierarchy].[Telecom Center].[Telecom Center].ALLMEMBERS *
[Net Object Hierarchy].[Switch].[Switch].ALLMEMBERS *
[Net Object Hierarchy].[Prefix].[Prefix].ALLMEMBERS *
[Measure].[Measure ID].[Measure ID].ALLMEMBERS *
DESCENDANTS([Date To].[Parent Date Key].[Level 02].ALLMEMBERS) ) } ON ROWS
FROM [Irtel Planning Statistics]
过滤数据的参数包括:“ paramcentraltelecomcenter”,“ paramprovince”,“ paramcounty”,“ paramdistrict”,...,“ paramprefix”。
例如,如果参数paramprovince的值设置为“ CA”,我只需要以[net object层次结构]的值检索这些记录。[省] =“ ca”。这应该很简单,但我完全迷失了。
有人可以帮我吗?提前致谢。
I'm having problem building MDX Queries in reporting service. I've searched through internet a lot about it and despite getting clear examples of MDX query and how to build it, I'm getting syntax error all the time. so here is the thing:
What I want to do is quite simple. I want to filter the data and only include rows that have equal values in corresponding columns and parameters. The original query generated by query builder is:
SELECT NON EMPTY { [Measures].[Value] } ON COLUMNS,
NON EMPTY {
([Net Object Hierarchy].[Central Telecom Center].[Central Telecom Center].ALLMEMBERS *
[Net Object Hierarchy].[Province].[Province].ALLMEMBERS *
[Net Object Hierarchy].[County].[County].ALLMEMBERS *
[Net Object Hierarchy].[District].[District].ALLMEMBERS *
[Net Object Hierarchy].[Rural].[Rural].ALLMEMBERS *
[Net Object Hierarchy].[Village].[Village].ALLMEMBERS *
[Net Object Hierarchy].[Telecom Center].[Telecom Center].ALLMEMBERS *
[Net Object Hierarchy].[Switch].[Switch].ALLMEMBERS *
[Net Object Hierarchy].[Prefix].[Prefix].ALLMEMBERS *
[Measure].[Measure ID].[Measure ID].ALLMEMBERS *
DESCENDANTS([Date To].[Parent Date Key].[Level 02].ALLMEMBERS) ) } ON ROWS
FROM [Irtel Planning Statistics]
The parameters to filter the data include: "paramCentralTelecomCenter", "paramProvince", "paramCounty", "paramDistrict", ..., "paramPrefix".
For instance, if the value of the parameter paramProvince is set to "CA", I just need to retrieve those records with the value of [Net Object Hierarchy].[Province].[Province]="CA". This should be very simple but I'm completely lost.
Can anyone help me with that please? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在 SELECT 中使用 WHERE 子句。这位于最后,FROM 之后。
例如,以下内容会将您的查询限制为“Province”设置为“CA”的元素:
You need to use a WHERE clause in your SELECT. This goes at the end, after the FROM.
For example, the following will restrict your query to those elements where Province is set to 'CA':