问题
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