在报告服务中使用过滤器构建分析服务查询 (MDX)

发布于 2024-12-04 10:12:25 字数 1182 浏览 3 评论 0原文

我在报告服务中构建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 技术交流群。

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

发布评论

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

评论(1

若水般的淡然安静女子 2024-12-11 10:12:25

您需要在 SELECT 中使用 WHERE 子句。这位于最后,FROM 之后。

例如,以下内容会将您的查询限制为“Province”设置为“CA”的元素:

WHERE [Net Object Hierarchy].[Province].[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':

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