Find min value of member, MDX

陌路散爱 提交于 2019-12-12 04:19:06

问题


Just started to explore MDX. Can anyone help me to get below result.

Looking to build a MDX query which gives same out as below SQL query

select max(date),min(date) from Fiscal_calendar

Where : 1. Fiscal_Calendar is dimension in cube 2. date is the attribute


回答1:


Min Date will be the First Child of the [All] member while Max Date will be the Last Child.

SELECT {Fiscal_Calendar.Date.[All].FirstChild, Fiscal_Calendar.Date.[All].LastChild} ON 1,
{} ON 0
FROM [YourCube]

Second last child:

Fiscal_Calendar.Date.[All].LastChild.Lag(1)



回答2:


SELECT {
        [Dimension - Fiscal Calendar].[Fiscal Quarter].members.item([Dimension - Fiscal Calendar].[Fiscal Quarter].members.count-2)
        ,[Dimension - Fiscal Calendar].[Fiscal Quarter].[All].firstChild
    } ON 1,{} ON 0 FROM [MyCube]

Thanks @SourabA. Above code worked out to me. Do let me know if any better approach



来源:https://stackoverflow.com/questions/34690554/find-min-value-of-member-mdx

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