2014-12-04 93 views
1

我试图获得最大的价值维度表,其中的数据与事实表简称如何使用MDX查询

WITH 
    MEMBER [Measures].[Max key] AS 
    Max 
    (
     [DimAnchorDate].[Date Key].MEMBERS 
    ,[DimAnchorDate].[Date Key].CurrentMember.Member_Key 
    ) 
SELECT 
    { 
    [Measures].[Max key] 
    } ON COLUMNS 
FROM X; 

此查询给我弄输出最大值高达20141031.数据从上面的查询我想获得20141031

enter image description here

所以现在我想从DimAnchordate表中获得最大的价值相同,因为它是在FactPatientDr表(即20141031)。所以未来p租赁建议我实现这一目标的最佳途径......

回答

1

我认为你正在寻找在立方体空间的某些部分是空的日期的那一刻 - 试图迫使到nonempty通过使用来自FactPatientDr

措施
WITH 
    MEMBER [Measures].[Max key] AS 
    Max 
    (
     nonempty(
     [DimAnchorDate].[Date Key].MEMBERS 
     ,[Measures].[SomeMeasureInFactPatientDr] 
    ) 
    ,[DimAnchorDate].[Date Key].CurrentMember.Member_Key 
    ) 
SELECT 
    { 
    [Measures].[Max key] 
    } ON COLUMNS 
FROM X; 
+0

感谢@whytheq它工作正常,我 – mohan111 2014-12-08 10:12:41

0

我想我们可以用尾巴函数来获取与测量值以及预期的结果:

select non empty([Measures].[Entered Case], 
    tail 
    (Order 
     ([Calendar].[Date].[Date].members 
     ,[Measures].[Entered Case] 
     ,basc 
    ) 
    ,1 
    )) on 0 from [SolutionPartner]