MDX在一个时间轴上组合了两个具有不同时间轴的度量

时间:2016-04-09 20:39:50

标签: date time mdx

我有两项措施Time_QuantityTime2_Quality。这些衡量指标涉及两个不同的时间表TimeTime2。但作为输出,我想要一个查询,向我展示一个时间轴上的两个度量。我想我必须结合时间和时间2,但如何?这就是我到目前为止所做的:

WITH 
  MEMBER [Time_Quantity] AS 
    (
      [Measures].[Quantity]
     ,[Measures].[Time-Quantity]
     ,[Time Dates].[Time Year-Quarter-Month-Date]
    ) 
  MEMBER [Time2_Quality] AS 
    (
      [Measures].[Quality]
     ,[Measures].[Time2-Quantity]
     ,[Time2 Dates].[Time2 Year-Quarter-Month-Date]
    ) 
SELECT 
  {
    Time_Quantity
   ,Time2_Quality
  } ON COLUMNS
 ,Timeline ON ROWS // **<<how to combine Time and Time2 Timeline in one single Timeline?**
FROM [Cube];

1 个答案:

答案 0 :(得分:0)

我认为您正在寻找类似下面的内容。它可能需要额外的开发,因为花费了13秒。

WITH MEMBER [Measures].[link_sales] AS 
     (LinkMember([Date].[Calendar].CURRENTMEMBER, [Ship Date].[Calendar]),[Measures].[Internet Sales Amount])
     MEMBER [Measures].[link_tax] AS 
     (LinkMember([Date].[Calendar].CURRENTMEMBER, [Ship Date].[Calendar]),[Measures].[Internet Tax Amount])
 SELECT   
    {[Measures].[link_sales],[Measures].[link_tax]} ON COLUMNS,
    NON EMPTY [Date].[Calendar].MEMBERS ON ROWS
 FROM [Adventure Works]

结果(时间:13秒)

              link_sales    link_tax
All Periods 29358677.2207   2348694.2301
CY 2005     3105587.3292    248446.991
H2 CY 2005  3105587.3292    248446.991
Q3 CY 2005  1349136.7362    107930.9407
July 2005   349490.1938 27959.2159