首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MDX计算当前YTD和前两年的会计期间平均值

MDX计算当前YTD和前两年的会计期间平均值
EN

Stack Overflow用户
提问于 2017-03-02 00:16:10
回答 1查看 168关注 0票数 0

我被要求为我们的多维数据集提供计算字段的平均值(加权后会很好,但没有加权是可以接受的),即今年到目前为止每个财务期(比如第7期)加上过去两个完整财年的招生人数-所以该范围内的其他26个财年)。

我已经研究了一段时间了,但是数字有点不准确,我不确定我使用的方法是正确的:

代码语言:javascript
复制
Avg(
{
periodstodate(
[1_Time].[Hierarchy].[Fiscal Year],
[1_Time].[Hierarchy].currentmember)
,
Descendants(
[1_Time].[Hierarchy].prevmember.parent,
[1_Time].[Hierarchy].[Period]
)
,
Descendants(
[1_Time].[Hierarchy].prevmember.prevmember.parent,
[1_Time].[Hierarchy].[Period]
)
}

, [Measures].[admissions]
)

1_Time的层次结构非常简单:会计年度、期间(1到13)和日期。

我一直在使用2016进行测试,我得到的值很接近,但并不正确。

有没有别的办法呢?

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-02 19:23:34

你可以在这里更简洁:

代码语言:javascript
复制
AVG(
    {[1_Time].[Hierarchy].CurrentMember.Parent.Lag(2).Children.Item(0):
    [1_Time].[Hierarchy].CurrentMember},
    [Measures].[admissions]
)

解释+示例:

代码语言:javascript
复制
[1_Time].[Hierarchy].CurrentMember -> 3 period 2017
.Parent -> 2017 year
.Lag(2) -> 2015 year
.Children -> set {1 period 2015 year : 13 period 2015 year)
.Item(0) -> 1 period 2015 year

{[1_Time].[Hierarchy].CurrentMember.Parent.Lag(2).Children.Item(0):
[1_Time].[Hierarchy].CurrentMember}
-> set {1 period 2015 year : 3 period 2017}

你说加权平均是什么意思?每天的水平?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42536758

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档