I have 2 dimensions Loans and Indicatordate in my database.


--Loan ID





I have written a function that returns me nearest Date from my database in case the date specified by the user does not exists.

The function applies to only those Loans for which the Indicator date is same as the Date entered my the user. It does not apply to all the loan Ids.

I want this function to return Indicator dates against all the Loan Ids and in case for a partcular Loan ID the date entered by the user does not exists then then i should get the Nearest 'Previous' existing Date for that Loan ID.

I want to know how can i apply this function to all the members of the Loan dimension ??

I have used "Head", along with Not Exists and Count functions as follows


{[Measures].[Arrear30to59]} on 0,
{Head (Filter (Descendants([LoansIndicatorDate].[All LoansIndicatorDate].children,3),NOT IsEmpty([LoansIndicatorDate].CurrentMember.Name="25" and [LoansIndicatorDate].Parent.Name="November" and [LoansIndicatorDate].parent.parent.Name="2005")),1).item(0)} on 1
from Loans