我是MDX的新手,我需要一些关于这个查询的帮助。
Generate(
filter(
[Dim Products].[Product].[Product].members
*
[Dim Date].week.week.members,
[Measures].[Price]
),
nonempty(
topcount(
[Dim Price].[Price].[Price]
*
[Dim Products].[Product].currentmember
*
[Dim Date].week.currentmember,
1,
[Measures].[Price Count]
)
)
) 我在仪表板工具(Dundas Dashboard)中使用上面命名的集合,以便检索模式(重复次数最多的价格值)。它确实显示了正确的结果,但速度很慢。如果单周有过滤器,则需要2-3秒;如果没有过滤器,则需要大约6-7秒(显示所有周的数据)。这是在SSMS中的,但是客户端工具需要更长的时间来获取结果集,有时会超时。
经过一些测试,事实表中的行数似乎不会影响性能,我已经大大减少了它,但仍然是一样的。然而,一旦我减少了2个维度表中的成员数量,性能就提高了- [Dim Price], [Dim Products].最初需要20+秒来获取结果集,但是一旦我减少了成员数量,性能就提高到了6-7秒,如下所示:
Table | Rows Before | Rows After
[Dim Price] | 2400 | 620
[Dim Products] | 1080 | 101这让我认为在3个维度之间存在一个影响性能的笛卡尔乘积。
我需要有人来建议我可以如何改善查询,以提高性能。
发布于 2014-05-20 20:33:38
在NONEMPTY函数之前尝试现有函数,如下所示:
Generate(
filter(
[Dim Products].[Product].[Product].members
*
[Dim Date].week.week.members,
[Measures].[Price] //<<<<<<<<<<SHOULD THIS NOT INCLUDE A CONDITION e.g. [Measures].[Price] > 0 ?
),
EXISTING nonempty(
topcount(
[Dim Price].[Price].[Price]
*
[Dim Products].[Product].currentmember
*
[Dim Date].week.currentmember,
1,
[Measures].[Price Count]
)
))
尝试2:
Generate(
filter(
NONEMPTY(
[Dim Products].[Product].[Product].members
*
[Dim Date].week.week.members,
[Measures].[Price]
)
),
EXISTING nonempty(
topcount(
[Dim Price].[Price].[Price]
*
[Dim Products].[Product].currentmember
*
[Dim Date].week.currentmember,
1,
[Measures].[Price Count]
)
)
)尝试3:
GENERATE(
FILTER(
NONEMPTY(
[Dim Products].[Product].[Product].MEMBERS
*
[Dim Date].week.week.MEMBERS
),
[Measures].[Price] > 0
),
TOPCOUNT(
NONEMPTY(
EXISTING
[Dim Price].[Price].[Price]
*
[Dim Products].[Product].currentmember
*
[Dim Date].week.currentmember,
[Measures].[Price Count]
),
1,
[Measures].[Price Count]
)
)https://stackoverflow.com/questions/23736449
复制相似问题