我使用以下计算成员来计算过去30天内我的访问的移动平均值;有没有更短的方法呢?
WITH
MEMBER [Measures].[Visits Moving Avg] AS
AVG(
[TIME].[Time].Prevmember : [TIME].[Time].Prevmember.Prevmember.Prevmember....
, [Measures].[VISITS]
), SOLVE_ORDER = 0
答案 0 :(得分:3)
您可以使用Lag MDX function函数,而不是使用prevMember.prevMember ...系列的系列:
WITH
MEMBER [Measures].[Visits Moving Avg] AS
AVG(
[TIME].[Time].prevMember : [TIME].[Time].prevMember.lag(30)
, [Measures].[VISITS]
), SOLVE_ORDER = 0
顺便说一下,查询中看起来缺少currentMember;您当前正在计算[时间]维度的默认成员的移动平均值。使用时间维度的currentMember的查询如下:
WITH
MEMBER [Measures].[Visits Moving Avg] AS
AVG(
[TIME].[Time].currentMemBer.prevMember
: [TIME].[Time].currentMemBer.prevMember.lag(30)
, [Measures].[VISITS]
), SOLVE_ORDER = 0