MDX - 在当前期间有效,在前一期间无效

时间:2014-10-08 23:15:21

标签: ssas mdx

在MDX中执行此操作的最有效方法是什么?我知道您可以创建2个计算的度量,在选择时间维当前周期时激活,而另一个具有前一个周期,然后执行具有复杂条件的过滤器。

然而,其他可能更有效的功能呢?有什么建议吗?

我的目标是创建一组计算度量,这将有助于客户分析师。主要的2个维度,对于这些是[日历],显然是[客户]。我有一个事实,其中包含客户的活动。这些是我们计算所依据的3个实体。

1 个答案:

答案 0 :(得分:0)

这是来自Chris Webb的一篇文章:http://cwebbbi.wordpress.com/2010/10/08/counting-new-and-returning-customers-in-mdx/

有关如何优化它的后续文章:http://cwebbbi.wordpress.com/2013/06/28/optimising-returning-customers-calculations-in-mdx/

WITH
MEMBER MEASURES.[Returning Customers] AS
COUNT(
NONEMPTY(
NONEMPTY(
[Customer].[Customer].[Customer].MEMBERS
, [Measures].[Internet Sales Amount])
, {[Measures].[Internet Sales Amount]}
* {NULL : [Date].[Calendar].CURRENTMEMBER.PREVMEMBER}
)
)
MEMBER MEASURES.[New Customers] AS
[Measures].[Customer Count] – MEASURES.[Returning Customers]
SELECT
{[Measures].[Customer Count]
, MEASURES.[Returning Customers]
, MEASURES.[New Customers]} ON 0,
[Date].[Calendar].[Calendar Year].MEMBERS ON 1
FROM [Adventure Works]
相关问题