SSAS Mdx使用Strtomember使用currentmember使以下MDX查询动态化

时间:2017-05-25 16:25:11

标签: ssas mdx

我有以下MDX查询来计算主动机会asofdate(由大于开始日期和小于关闭日期定义)

当日期值是硬编码时,这是有效的。但是我想让它与.currentmember一起工作,它接受层次结构中的成员并计算两个日期之间的开放机会

with member

[Measures].[Cumulative_count_dates]
as 
AGGREGATE(
{NULL:[Time Dimension].[Year-Qtr-Month-Date].[Date].&[2011-10-09T00:00:00]} * {[Opportuntity Close Dt].[Year-Qtr-Month-Date].[Date].&[2011-10-11T00:00:00] : NULL} 

 , [Measures].[Opportunities Count]
)

select {[Measures].[Cumulative_count_dates]} on columns,
NON EMPTY {[Time Dimension].[Year-Qtr-Month-Date].members} on rows
from AdventCube

换句话说,我希望将其作为变量传递

[Time Dimension].[Year-Qtr-Month-Date].[Date].&[2011-10-09T00:00:00]

请帮忙。

1 个答案:

答案 0 :(得分:0)

CurrentMember出了什么问题?

with member

[Measures].[Cumulative_count_dates]
as 
AGGREGATE(
{NULL:[Time Dimension].[Year-Qtr-Month-Date].CurrentMember} * {[Opportuntity Close Dt].[Year-Qtr-Month-Date].[Date].&[2011-10-11T00:00:00] : NULL} 

 , [Measures].[Opportunities Count]
)

select {[Measures].[Cumulative_count_dates]} on columns,
NON EMPTY {[Time Dimension].[Year-Qtr-Month-Date].[Date].members} on rows
from AdventCube