2

我试图在不同的行上获得两个不同的 topcount,猜我在某处想错了吗?

select{
([Measures].[Invoiced_DAm])
} on columns,

    topcount(
        [07 Prod].[Product_Descr].children
        ,10
        ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2008])
    ),
    topcount(
        [07 Prod].[Product_Descr].children
        ,10
        ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2009])
    ) on rows
4

1 回答 1

1

如何让它工作只需将 TOPCOUNT 操作放在花括号之间{ }

select{
([Measures].[Invoiced_DAm])
} on columns,
{
    topcount(
        [07 Prod].[Product_Descr].children
        ,10
        ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2008])
    ),
    topcount(
        [07 Prod].[Product_Descr].children
        ,10
        ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2009])
    )
} on rows

为什么?因为这是 MDX 区分集合的方式:只要明确列出元组,我们就需要用大括号将元组括起来。TOPCOUNT 函数将返回(在这种情况下)来自 Product 维度的前 10 个元组。

在您的情况下TOPCOUNT(...), TOPCOUNT(...),对 MDX 没有任何意义(两组或元组列表,用逗号分隔)。

{TOPCOUNT(...), TOPCOUNT(...)}将告诉 MDX 您要显示来自两个 TOPCOUNT 语句的行集,因此您声明了 Set of sets,它本身就是一个集合。

于 2013-03-15T11:07:34.573 回答