Hi
Can any one plese help me in retreiving the latest Startdate record with its corresponding record using calculated member in ssas. I have four dimension out of which two are date dimension and the last is department.
EmployeeId StartDate EndDate Dept
101 03/02/2013 01/01/2014 Dept1
102 04/07/2012 25/05/2005 Dept5
102 25/05/2005 15/06/2012 Dept7
101 02/01/2014 27/09/2015 Dept6
102 15/06/2012 20/10/2015 Dept4
Each column is maintatined individual dimensions.
My result required should be latest start date and its corresponding row like below
EmployeeId StartDate EndDate Dept
101 02/01/2014 27/09/2015 Dept6
102 15/06/2012 20/10/2015 Dept4
Thank you in advance
What I have tried:
WITH
MEMBER [Measures].[LatestEmpStartDate] AS
TAIL(NONEMPTY([Emp_StartDate].[Full Date].[Full Date].MEMBERS, [Measures].[No_of_Emp]),1).ITEM(0).MEMBER_NAME
MEMBER [Measures].[LatestEmpEndDate] AS
TAIL(NONEMPTY(
{LINKMEMBER(TAIL(NONEMPTY([Emp_StartDate].[Full Date].[Full Date].MEMBERS, [Measures].[No_of_Emp]),1).ITEM(0)
,[Emp_EndDate].[Full Date]) : null}
, [Measures].[No_of_Emp]),1).ITEM(0).MEMBER_NAME
MEMBER [Measures].[LatestDept] AS
TAIL(NONEMPTY(
{LINKMEMBER(TAIL(NONEMPTY([Emp_StartDate].[Full Date].[Full Date].MEMBERS, [Measures].[No_of_Emp]),1).ITEM(0)
, [DIM_Dept].[Dept_Code])}
, [Measures].[No_of_Emp]),1).ITEM(0).MEMBER_NAME
SELECT
{
[Measures].[LatestEmpStartDate]
, [Measures].[LatestEmpEndDate]
, [Measures].[LatestDept]
} on columns
,NON EMPTY
[Employee].[EmpID].members
on ROWS
From Cub_