2013-05-09 50 views
1

我需要構建一個報表,以顯示多維數據集中的日常更改。例如。帳戶,我們顯示在天X和Y日資產負債的平衡我是這樣實現的:MDX:從單元格中緩慢變化的維度獲取屬性

WITH 
MEMBER OldBalance AS ([Balance], [Date].[Date].[2013-05-01]) -- start date 
MEMBER NewBalance AS ([Balance], [Date].[Date].[2013-05-04]) -- end date 
SELECT {OldBalance, NewBalance} ON COLUMNS 
[Account].[AccountNumber].[AccountNumber] ON ROWS 
FROM TheCube 

這顯示了每個帳戶的兩列,每個人的快樂:

 OldBalance NewBalance 
ACT123 1050.25  1048.29 
ACT345 950.08  1421.92 

另外到賬號,[賬號]維也有SalesRepName作爲屬性,並且SalesRepName的值可能隨時間而改變,使[賬號]變化緩慢。我希望看到的是沿着線的東西:

 OldBalance NewBalance OldSalesRep NewSalesRep 
ACT123 1050.25  1048.29 John Smith John Smith 
ACT345 950.08  1421.92 John Smith George Fisher 

但我不知道如何在MDX實現這一點,無論是甚至有可能。

回答

1

的訣竅是使用類似TopCount然後Item

WITH 
MEMBER [Date].[Date].StartDate AS [Date].[Date].[2013-05-01] 
MEMBER [Date].[Date].EndDate AS [Date].[Date].[2013-05-04] 
MEMBER OldBalance AS ([Balance], [Date].[Date].StartDate) 
MEMBER NewBalance AS ([Balance], [Date].[Date].EndDate) 
MEMBER OldSalesRep AS 
    TopCount(
     NonEmpty(
      ([Account].[SalesRep].[SalesRep], [Date].[Date].StartDate, 
      [Account].[AccountNumber].CurrentMember), [Balance]), 
     1) 
    .Item(0).Item(0).Properties("Caption") 
MEMBER NewSalesRep AS 
    TopCount(
     NonEmpty(
      ([Account].[SalesRep].[SalesRep], [Date].[Date].EndDate, 
      [Account].[AccountNumber].CurrentMember), [Balance]), 
     1) 
    .Item(0).Item(0).Properties("Caption") 
SELECT {OldBalance, NewBalance, OldSalesRep, NewSalesRep} ON COLUMNS 
[Account].[AccountNumber].[AccountNumber] ON ROWS 
FROM TheCube

請記住,但是,在大立方體的性能可能並不好。

相關問題