MDX allows use VB Script Functions.
So, for converting date format we can make use of these function as shown in query below.
Example 1
WITH MEMBER [Measures].[ParameterCaption] AS
IIF(ISDATE([Date].[Calendar].CURRENTMEMBER.MEMBER_CAPTION)
,VBA!Format
(
Cdate([Date].[Calendar].CURRENTMEMBER.MEMBER_CAPTION)
,"MMMM yyyy"
)
,[Date].[Calendar].CURRENTMEMBER.MEMBER_CAPTION)
MEMBER [Measures].[ParameterValue] AS
[Date].[Calendar].CURRENTMEMBER.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS
[Date].[Calendar].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption]
, [Measures].[ParameterValue]
, [Measures].[ParameterLevel]} ON COLUMNS
, [Date].[Calendar].ALLMEMBERS ON ROWS
FROM [Adventure Works]
Link for more VB Script Functions
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp
So, for converting date format we can make use of these function as shown in query below.
Example 1
WITH MEMBER [Measures].[ParameterCaption] AS
IIF(ISDATE([Date].[Calendar].CURRENTMEMBER.MEMBER_CAPTION)
,VBA!Format
(
Cdate([Date].[Calendar].CURRENTMEMBER.MEMBER_CAPTION)
,"MMMM yyyy"
)
,[Date].[Calendar].CURRENTMEMBER.MEMBER_CAPTION)
MEMBER [Measures].[ParameterValue] AS
[Date].[Calendar].CURRENTMEMBER.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS
[Date].[Calendar].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption]
, [Measures].[ParameterValue]
, [Measures].[ParameterLevel]} ON COLUMNS
, [Date].[Calendar].ALLMEMBERS ON ROWS
FROM [Adventure Works]
Link for more VB Script Functions
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp
No comments:
Post a Comment