how to get Min values for dimension members?

482 Views Asked by At

I have a cube with few dimensions. Report Date and Account are two of them. One account id may come under multiple Report dates. I need to find minimum report date for every accountid. Any ideas?

1

There are 1 best solutions below

2
On

Maybe something similar -

WITH SET[MinDate] AS
    Head(NonEmpty(
            ReportDate.[ReportDate].[ReportDate].MEMBERS, 
            {(EXISTING [Account].[AccountId].CurrentMember , [Measures].[foo])}
            ),1)

SELECT [MinDate] ON 1,
[Account].[AccountId].MEMBERS ON 0
FROM [bar]
WHERE [Measures].[foo]

If what you want is the minimum date's value, then you would need to get that in a calculated measure instead of a set.

WITH MEMBER Measures.[MinimumDate] AS
    Head(NonEmpty(
            ReportDate.[ReportDate].[ReportDate].MEMBERS, 
            {(EXISTING [Account].[AccountId].CurrentMember , [Measures].[foo])}
            ),1).ITEM(0).Name