按列获取总计

时间:2019-01-14 19:16:21

标签: sql ssas mdx

我想通过列维(时间维)计算MDX中给定度量的总计

这是我的MDX代码:

SUM(
([DIM_TIME].[PERIOD]), 
[Measures].[VALUE]
)

基本上,这就是我想要得到的:

Expected output

但这就是我得到的:

Actual output

感谢任何可能的帮助

1 个答案:

答案 0 :(得分:0)

看看示例查询

with member 
[Measures].[Internet Sales AmountTotal]
as
case when [Product].[Category].currentmember is  [Product].[Category].defaultmember then null
else ([Product].[Category].defaultmember,[Measures].[Internet Sales Amount])
end

select
({[Date].[Calendar Year].&[2012],[Date].[Calendar Year].&[2013]},
{[Measures].[Internet Sales Amount],[Measures].[Internet Sales AmountTotal]})
on columns,
{[Product].[Category].members}
on rows 
from [Adventure Works]

enter image description here