iccube:如何计算 mdx 中带有 where 子句的成员数?

iccube : how to count number of members with where clause in a mdx?

使用下面的 mdx,如果我 运行 它有或没有 where 子句,结果是相同的:它 returns 层次结构中的总年数。

with member nbYears as [Time].[Year].[Year].count
select nbYears on 0
from [Sales]
where [Time].[2007]

您可以使用Existing MDX函数

WITH 
   member nbYears as (Existing [Time].[Year].[Year]).count
SELECT nbYears on 0
FROM [Sales]
WHERE [Time].[2007]