MDX SSAS - Max Date in Measure

萝らか妹 提交于 2020-01-03 14:00:25

问题


Just need to get MAX date in ALL my Measures in the Cube. For instance, DateID is a Dimention, [Measure].[First Measure],...,...,[Second Measure].

How to get list of MAX(DateID) from all Measures in my Cube.


回答1:


The following will get you the max date value associated with each measure...but you will have to manually create a calculated member corresponding to each measure.

WITH
    MEMBER [Measures].[Max Date - Internet Sales Amount] AS
        TAIL(
            NONEMPTY(
                [Date].[Date].[Date]
                ,[Measures].[Internet Sales Amount]
            )
            ,1
        ).Item(0).MemberValue
    MEMBER [Measures].[Max Date - Reseller Sales Amount] AS
        TAIL(
            NONEMPTY(
                [Date].[Date].[Date]
                ,[Measures].[Reseller Sales Amount]
            )
            ,1
        ).Item(0).MemberValue
SELECT
    {
        [Measures].[Max Date - Internet Sales Amount],
        [Measures].[Max Date - Reseller Sales Amount]
    } ON 0
FROM
    [Adventure Works]

If you want to get the single max date across all measures in the cube, you'll need to take a different approach.



来源:https://stackoverflow.com/questions/18598669/mdx-ssas-max-date-in-measure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!