I need to convert a member value from this format dd.MM.yyyy
into a CDate.
This was my trial:
cdate(format([Date].[Date].CURRENTMEMBER.MEMBER_VALUE, "dd.MM.yyyy"))
Source: http://www.datazen.com/blogs/post/working-with-dates-in-datazen-3-0
However, I get a type mismatch error, because the format function ist not working properly.
I'm using a Microsoft Analysis Server.
Do someone know a solution for this issue?
You need to create a measure when to extract the date.
Here is a possible route:
MEMBER [Measures].[Date as int] as
[Date].[Date].CURRENTMEMBER.Properties('Key0', Typed)
MEMBER [Measures].[Date Year] as
Fix([Measures].[Date as int] / 10000)
MEMBER [Measures].[Date Month] as
Fix(([Measures].[Date as int] - [Measures].[Date Year] * 10000) / 100)
MEMBER [Measures].[Date Day] as
[Measures].[Date as int] - [Measures].[Date Year] * 10000 - [Measures].[Date Month] * 100
MEMBER [Measures].[DateValue_attempt1] as
// convert it to Date data type and use a format string on that:
DateSerial([Measures].[Date Year], [Measures].[Date Month], [Measures].[Date Day]),
format_string = 'dd.MM.yyyy'
MEMBER [Measures].[DateValue_attempt2] as
//if above fails maybe just convert it to string & do further conversion in client
[Measures].[Date Day] + "." +
[Measures].[Date Month] + "." +
[Measures].[Date Year]