MDX和AVG功能

发布于 2024-11-09 19:52:14 字数 513 浏览 3 评论 0原文

不确定这是否是 MDX 问题的正确位置,但它似乎是最合适的。

我有关于 MDX 和 AVG 函数的问题。

我想计算一年中几个月的平均销售额。

所以我想计算 2010/01/01、2010/02/01、2010/03/01 等的 AVG...以及每月的每一天。

谁能给我一个提示,告诉我如何才能做到这一点?

我会选择看起来像这样的东西

WITH MEMBER [Measures].[Total] AS AVG(DESCENDANTS([Time].[2010], [Day]),[Measure].[Sale])

谢谢您,

更新

我提出了一个新问题,对我的问题和研究案例进行了更清晰的解释。

请在以下位置找到它:MDX:平均高级使用

Not sure if this is the right place for MDX question but it seemed to be the most appropriate.

I have a question about MDX and the AVG function.

I would like to compute the average sale amount by day across several month for a year.

So I would like to compute the AVG of the 2010/01/01, 2010/02/01, 2010/03/01, etc... and this for everyday of the month.

Can anyone give me a hint on how I'd be able to do that ?

I would go for something that looks like this

WITH MEMBER [Measures].[Total] AS AVG(DESCENDANTS([Time].[2010], [Day]),[Measure].[Sale])

Thank you,

UPDATE

I have open a new question with a clearer explanation of my problem and study case.

Please find it at : MDX: avg advanced use

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

腹黑女流氓 2024-11-16 19:52:14

你走在正确的轨道上。您可以使用以下方法计算平均值:

WITH
MEMBER [Measures].[Average Sales] AS
    AVG(DESCENDANTS([Time].[Calendar].CurrentMember, 
                    [Time].[Calendar].[Date]), 
        [Measure].[Sale])
SELECT
{
    [Measures].[Average Sales]
} ON 0,
{
    [Time].[Calendar].[Month]
} ON 1
FROM [YourCube]

这将为您提供所选时间维度的日历层次结构中每个成员的平均值。它适用于年、季度、月等,并将在指定成员下的天数内平均销售量。在您的情况下,您只需在行或列上选择月份,如代码示例所示。

You are on the right track. You can compute the average with:

WITH
MEMBER [Measures].[Average Sales] AS
    AVG(DESCENDANTS([Time].[Calendar].CurrentMember, 
                    [Time].[Calendar].[Date]), 
        [Measure].[Sale])
SELECT
{
    [Measures].[Average Sales]
} ON 0,
{
    [Time].[Calendar].[Month]
} ON 1
FROM [YourCube]

This will give you the average for each member of the Calendar hierarchy of the Time dimension which you select. It will work for Years, Quarters, Months, etc and will average the Sale measure over days under the specified members. In your case you can just select Month on ROWS or COLUMNS as shown in the code sample.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文