Friday, March 23, 2012

Finding a Member

Hi,
I try to evaluate a functionality to find a date-Member. Wath we need
is, we search the first existing Date in our Time-Dimension, which is,
say 11 days before the actual-date. Since such a Member maybe not
exits, the function should return the smallest existing Date bigger then the
one we are searching for.

MEMBER [MEASURES].[date1] AS
DATEADD("d", -11, CDate([Zeit].[Zeit].CURRENTMEMBER.MEMBER_CAPTION))
MEMBER [MEASURES].[mydate] AS
FILTER([Zeit].[Zeit].[Datum].members,
cdate([Zeit].[Zeit].[Datum].value) >= [MEASURES].[date1]).Item(0)
It doesn’t work in that way.
Can anybody give me some Help.
Thank you very much.

Bahram.

Looks like the problem here with the use of .Value function, which will retrieve cell value. If you are using AS2005, you can rewrite the Filter to be

FILTER([Zeit].[Zeit].[Datum].members, [Zeit].[Zeit].CurrentMember.MemberValue >= [MEASURES].[date1]).Item(0))

HTH

Mosha (http://www.mosha.com/msolap)

|||

Hi,

I tried your Formula. It doesn't work, i.e. it returns all Dates (([Zeit].[Zeit].[Datum].members). I think, it's becouse of the calculation of [MEASURES].[date1]. It uses the Currentmember and wenn the filter itterates through the members, it calculates the [MEASURES].[date1] again and again.

I don't know, if its correct or not!

Thanke you

|||Sorry - I didn't notice that date1 was going against CurrentMember in Zeit dimension. It needs to be fixed on the particular date that you are interested in for this Filter to work correctly.sql

No comments:

Post a Comment