Sunday, November 3, 2013

SSAS Ages at current date

CREATE MEMBER CURRENTCUBE.[Measures].[Age Years]
AS Datediff("yyyy",[Customer].[Birth Date].CurrentMember.Name, NOW()),
VISIBLE = 1, DISPLAY_FOLDER = 'Ages' ;

CREATE MEMBER CURRENTCUBE.[Measures].[Age Months]
AS Datediff("M",[Customer].[Birth Date].CurrentMember.Name, NOW()),
VISIBLE = 1 , DISPLAY_FOLDER = 'Ages' ; 

CREATE MEMBER CURRENTCUBE.[Measures].[Age Months To Years]
 AS Datediff("M",[Customer].[Birth Date].CurrentMember.Name, NOW())/12,
FORMAT_STRING = "#.##0,0",
VISIBLE = 1 ,  DISPLAY_FOLDER = 'Ages'  ; 

CREATE MEMBER CURRENTCUBE.[Measures].[Age Days]
AS Datediff("d",[Customer].[Birth Date].CurrentMember.Name, NOW()),
VISIBLE = 1, DISPLAY_FOLDER = 'Ages' ;

Till Next Time

No comments: