我写了以下MDX查询:
SUM(
(
Filter
([Shop].[Shop ID].[Shop ID].Members,
IsEmpty(([Time].[Calendar].CurrentMember))
= false
AND
IsEmpty(([Time].[Calendar].CurrentMember.Lag(1)))
= false
AND
IsEmpty(([Time].[Calendar].CurrentMember.Lag(2)))
= false)
,
[Measures].[Real weight]
)
)
然而它运作缓慢。我相信我可以加快速度。有任何想法吗? 我已经阅读了以下博客,但它对我帮助不大。可能我会错过那里重要的事情:
提前致谢!
修改:
对不起,请在此处找到答案:http://sqlblog.com/blogs/mosha/archive/2008/10/22/optimizing-mdx-aggregation-functions.aspx
SUM([Shop].[Shop ID].[Shop ID].Members,
(
IIF(
IsEmpty(([Time].[Calendar].CurrentMember,[Measures].[Real weight]))
= false
AND
IsEmpty(([Time].[Calendar].CurrentMember.Lag(1),[Measures].[Real weight]))
= false
AND
IsEmpty(([Time].[Calendar].CurrentMember.Lag(2),[Measures].[Real weight]))
= true
,
[Measures].[Real weight]
,
NULL)
))
答案 0 :(得分:1)
对不起,请在此处找到答案:http://sqlblog.com/blogs/mosha/archive/2008/10/22/optimizing-mdx-aggregation-functions.aspx
SUM([Shop].[Shop ID].[Shop ID].Members,
(
IIF(
IsEmpty(([Time].[Calendar].CurrentMember,[Measures].[Real weight]))
= false
AND
IsEmpty(([Time].[Calendar].CurrentMember.Lag(1),[Measures].[Real weight]))
= false
AND
IsEmpty(([Time].[Calendar].CurrentMember.Lag(2),[Measures].[Real weight]))
= true
,
[Measures].[Real weight]
,
NULL)
))