MDX中的乘积和(乘法)之和

时间:2013-04-24 21:09:11

标签: sql-server-2008 ssas mdx

我有一个像这样的MDX查询:

with 
member [Measures].[Currency] as [Currency].[Code].Currentmember.Member_Key
member [Measures].[Date] as [Time].[Date].Currentmember.Member_Key
member [Measures].[Wholesale Price Totals] as [Measures].[Wholesale Price] * [Measures].[Net Sold Units]
select
{
[Measures].[Currency]
,[Measures].[Date]
,[Measures].[Sold Units]
,[Measures].[Wholesale Price Totals]
}
on columns,
ORDER
(
    NONEMPTY
    (
        CROSSJOIN
        (
            {[Time].[Date].&[2013-02-26T00:00:00],[Time].[Date].&[2013-02-27T00:00:00]}
            ,EXCEPT([Currency].[Code].Members, [Currency].[Code].[All])
        ), 
        [Measures].[Sold Units]
    ), 
    [Measures].[Date], BASC
)
on rows
from MyCube

我需要[批发价格总计]所有[已售单位](是数量)* [批发价格]的总和。像这样的查询检索所有出售单位的总和乘以Wolesale价格的总和,我需要得到每个出售单位的总和" cell"乘以批发价格。

我几天前就试图这样做,这让我疯了!

提前致谢!

1 个答案:

答案 0 :(得分:0)

需要在叶级进行乘法,这使得它比常规测量慢得多。理想情况下,您应该考虑ETL阶段的乘法。如果不可能,您可以使用以下帖子http://sqlblog.com/blogs/mosha/archive/2005/02/13/performance-of-aggregating-data-from-lower-levels-in-mdx.aspx

中描述的方法