MDX查询显示今年的销售以及去年的销售

时间:2012-07-10 20:40:28

标签: mdx

这是我的查询。我想显示今年第12周到第24周的数据以及去年第12周到第24周的数据。但是我得到了相同的数据,即使我有“prevMember”。你能帮帮我吗?

WITH MEMBER [Measures].[Net Sales This Year] AS ([Measures].[Ticket Net Sales],[Date].[Fiscal].[Fiscal Year].currentmember.prevmember)  

SELECT {[Measures].[Ticket Net Sales],[Measures].[Net Sales Last Year]} on 0,

NON EMPTY {([Concepts].[Concept Name].[Concept Name],[Locations].[Department Name].[Department Name],
            [Date].[Fiscal].[Fiscal Year].Members,[Date].[Week Of Year].&[12]:[Date].[Week Of Year].&[24])} on 1

FROM spbi

2 个答案:

答案 0 :(得分:1)

您可以使用PARALLELPERIOD()功能来实现此目的。

请参阅http://technet.microsoft.com/en-us/library/ms145500

答案 1 :(得分:0)

您可以尝试此查询:

WITH MEMBER [Measures].[Net Sales This Year] AS ([Measures].[Ticket Net Sales],[Date].[Fiscal].CurrentMember.PrevMember)  

SELECT {[Measures].[Ticket Net Sales],[Measures].[Net Sales Last Year]} ON 0,

NON EMPTY [Date].[Fiscal].[Fiscal Year].Members * [Date].[Week Of Year].&[12]:[Date].[Week Of Year].&[24]) ON 1

FROM spbi