Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的数据示例:
id value_a 1 1.0 2 2.0 3 3.0 4 4.0
我想要的是
id / value_a / recent_n_avg 1 1.0 0.33 2 2.0 1.00 3 3.0 2.00 4 4.0 3.00
recent_n_avg 是最近 n 行的平均值(例如 n=3)。
如何使用 MDX 来解决这个问题。
谢谢。
如果您只想为一个维度执行此操作并且该维度是平坦的,您可以为新的计算成员编写以下表达式:
SUM({[Dimension].CurrentMember.Lag(2):[Dimension].CurrentMember}, [Measures].[Your measure])/3
此外,您应该记住您维度中的成员“全部”和成员 #1,2。