Hi,greg lipman
- define 2 calculated members :
[Measures].[FirstPaymentDate]
and[Measures].[LastPaymentDate]
. - use the
Min
andMax
to find the earliest and latest payment dates for each claim. -
NonEmpty
function is used to ensure that only dates where a payment has occurred (i.e., where[Measures].[Amount]
is not empty) are considered. - The
SELECT
statement determines the data displayed through columns (COLUMNS) and rows (ROWS). Here,[Measures].[FirstPaymentDate]
and[Measures].[LastPaymentDate]
are placed on the columns. - The rows are defined by the Cartesian product of
[Person].[Hierarchy].[Person Name].MEMBERS
(all member names of personnel) and[Claims].[ID].MEMBERS
(all members of claim IDs). - The
NON EMPTY
keyword is used to exclude combinations in this Cartesian product that have no payments, thereby only displaying combinations that have at least one payment record.
WITH
MEMBER [Measures].[FirstPaymentDate] AS
Min(
NonEmpty(
[Claims].[ID].CurrentMember * [Date].[Date].Members,
[Measures].[Amount]
),
[Date].[Date].CurrentMember
)
MEMBER [Measures].[LastPaymentDate] AS
Max(
NonEmpty(
[Claims].[ID].CurrentMember * [Date].[Date].Members,
[Measures].[Amount]
),
[Date].[Date].CurrentMember
)
SELECT {
[Measures].[FirstPaymentDate],
[Measures].[LastPaymentDate]
}
ON COLUMNS,
NON EMPTY (
[Person].[Hierarchy].[Person Name].MEMBERS,
[Claims].[ID].MEMBERS
)
ON ROWS
FROM [mycube]
Regards
Mikey Qiao If you're satisfied with the answer, don't forget to "Accept it," as this will help others who have similar questions to yours.