输出MDX的附加总行数
如何从以下MDX中获取要输出的附加总行:输出MDX的附加总行数,mdx,Mdx,如何从以下MDX中获取要输出的附加总行: SELECT { [Measures].[Internet Sales Amount] ,[Measures].[Internet Gross Profit] ,[Measures].[Sales Amount] } ON COLUMNS ,NON EMPTY {[Customer].[City].[City] * [Product].[Product].[Product]} ON ROWS FROM [Adve
SELECT
{
[Measures].[Internet Sales Amount]
,[Measures].[Internet Gross Profit]
,[Measures].[Sales Amount]
} ON COLUMNS
,NON EMPTY
{[Customer].[City].[City] * [Product].[Product].[Product]} ON ROWS
FROM [Adventure Works]
WHERE
(
[Date].[Fiscal Weeks].[Fiscal Year].&[2007]
,[Employee].[Employee Department].[Employee].&[105]
);
我可以从纯SQL中得到。下面是SQL聚合模拟
select
[Customer].[City].[City],[Product].[Product].[Product]
, sum([Measures].[Internet Sales Amount]) as [Measures].[Internet Sales Amount]
, sum([Measures].[Internet Gross Profit]) as [Measures].[Internet Gross Profit]
, sum([Measures].[Sales Amount]) as [Measures].[Sales Amount]
from [Adventure Works]
where [Date].[Fiscal Weeks].[Fiscal Year].&[2007] and [Employee].[Employee Department].[Employee].&[105]
group by [Customer].[City].[City],[Product].[Product].[Product]
union
select
'Total' ,null
, sum([Measures].[Internet Sales Amount]) as [Measures].[Internet Sales Amount]
, sum([Measures].[Internet Gross Profit]) as [Measures].[Internet Gross Profit]
, sum([Measures].[Sales Amount]) as [Measures].[Sales Amount]
from [Adventure Works]
where [Date].[Fiscal Weeks].[Fiscal Year].&[2007] and [Employee].[Employee Department].[Employee].&[105]
是否需要额外的单个“所有成员”输出
Select
{
[Measures].[Internet Sales Amount],
[Measures].[Internet Gross Profit],
[Measures].[Sales Amount]
} on 0,
{
[Customer].[City].[All] *
[Product].[Product].[All]
+
NonEmptyCrossJoin(
[Customer].[City].[City].Members,
[Product].[Product].[Product].Members,
2
)
} on 1
From [Adventure Works]
Where
(
[Date].[Fiscal Weeks].[Fiscal Year].&[2007],
[Employee].[Employee Department].[Employee].&[105]
)
顺便说一下,有。此外,您可能会发现对理解MDX交叉连接很有用。是否需要额外的单个“所有成员”输出
Select
{
[Measures].[Internet Sales Amount],
[Measures].[Internet Gross Profit],
[Measures].[Sales Amount]
} on 0,
{
[Customer].[City].[All] *
[Product].[Product].[All]
+
NonEmptyCrossJoin(
[Customer].[City].[City].Members,
[Product].[Product].[Product].Members,
2
)
} on 1
From [Adventure Works]
Where
(
[Date].[Fiscal Weeks].[Fiscal Year].&[2007],
[Employee].[Employee Department].[Employee].&[105]
)
顺便说一下,有。此外,您可能会发现了解MDX交叉连接很有用。Danylo的答案可能不是完美的方法:
[Customer].[City].[All]*[Product].[Product].[All].[code>试图交叉连接成员,但他需要显式创建这些单个成员集:{[Customer].[City].[All]}*{[Product].[Product].[All]}
NonEmptyCrossJoin
是过去的残余,最好避免:SELECT
{
[Measures].[Internet Sales Amount]
,[Measures].[Internet Gross Profit]
,[Measures].[Sales Amount]
} ON COLUMNS
,NON EMPTY
{
(
[Customer].[City].[All]
,[Product].[Product].[All]
)
,{[Customer].[City].[City] * [Product].[Product].[Product]}
} ON ROWS
FROM [Adventure Works]
WHERE
(
[Date].[Fiscal Weeks].[Fiscal Year].&[2007]
,[Employee].[Employee Department].[Employee].&[105]
);
Danylo的答案可能不是完美的方法:
[Customer].[City].[All]*[Product].[Product].[All].[code>试图交叉连接成员,但他需要显式创建这些单个成员集:{[Customer].[City].[All]}*{[Product].[Product].[All]}
NonEmptyCrossJoin
是过去的残余,最好避免:SELECT
{
[Measures].[Internet Sales Amount]
,[Measures].[Internet Gross Profit]
,[Measures].[Sales Amount]
} ON COLUMNS
,NON EMPTY
{
(
[Customer].[City].[All]
,[Product].[Product].[All]
)
,{[Customer].[City].[City] * [Product].[Product].[Product]}
} ON ROWS
FROM [Adventure Works]
WHERE
(
[Date].[Fiscal Weeks].[Fiscal Year].&[2007]
,[Employee].[Employee Department].[Employee].&[105]
);