1

我有一个工作查询,我想稍微改变一下。

工作查询为我提供了用户参与的每个活动的计算度量值。

由于在这个查询示例中,有 2 个计算值 0 和该用户参与的 2 个活动的每个 7,我应该能够转换查询以显示具有两个值的平均值的单个用户行,例如 3.5 。

这就是我卡住的地方。有谁知道如何将结果中的 [Day Diff Exposure to Download] 添加到 [Avg Day Diff...] 计算?

非常感谢您的帮助。

这是原始的工作查询:

with
member [measures].FirstEventDate as CDate(Head(NonEmpty([DIM DATE].[Date].[Date], ([Measures].[Count], [DIM USER].[Email].CurrentMember, [DIM CAMPAIGN].[Campaign].CurrentMember))).item(0).member_caption)
member [measures].[Day Diff Exposure to Download] as ([DIM EVENT].[Event].[Event Name].&[download], [measures].FirstEventDate) - ([DIM EVENT].[Event].[Event Name].&[exposure], [measures].FirstEventDate)
select
[measures].[Day Diff Exposure to Download] on columns,
NonEmpty (
    {([DIM USER].[Email].[User Email].&[100000@mail.com],
    [DIM CAMPAIGN].[CampaignTypeName].[Campaign Name])},
    [DIM EVENT].[Event].[Event Name].&[download]
) on rows
from [MyCube]

这是我目前升级查询的失败尝试:

with
member [measures].FirstEventDate as CDate(Head(NonEmpty([DIM DATE].[Date].[Date], ([Measures].[Count], [DIM USER].[Email].CurrentMember, [DIM CAMPAIGN].[Campaign].CurrentMember))).item(0).member_caption)
member [measures].[Day Diff Exposure to Download] as ([DIM EVENT].[Event].[Event].&[download], [measures].FirstEventDate) - ([DIM EVENT].[Event].[Event].&[exposure], [measures].FirstEventDate)
member [measures].[Avg Day Diff] as
Avg(
    NonEmpty(
        {[DIM CAMPAIGN].[Campaign].[Campaign]},
        (
            [DIM USER].[Email].CurrentMember,
            [DIM EVENT].[Event].[Event].&[download]
        )
    ),
    [measures].[Day Diff Exposure to Download]
)
select
[measures].[measures].[Avg Day Diff] on columns,
NonEmpty (
    {[DIM USER].[Email].[Email].&[100000@mail.com]},
    [DIM EVENT].[Event].[Event].&[download]
) on rows
from [MyCube]

不幸的是,目前尝试的查询没有返回值 3.5,而是返回 -13738.3333333。

4

1 回答 1

1

您可能还需要在 nonEmpty 集中指定度量值;就像是:

NonEmpty( [measures].FirstEventDate * { ... } )
于 2013-04-16T12:13:42.213 回答