MDX #12 – Do not forget the TYPED flag in the Properties() function
Continue from my previous blog, MDX #11 – How to get number of cars each customer owned using Properties() function?.
Without the TYPED flag, Employee ID is no longer a number, but a text field in Excel
A couple of months ago, I completed a small project to create a calculated measure from the Employee dimension member property Employee ID. A couple of weeks later, a user reported that the Excel PivotTable he has been using to access the cube stopped working because the Employee ID is no longer a number, but a text field now.
Without the TYPED flag, the return value is always a string
In the MSDN MDX reference library, Properties (MDX), in the Remarks section, it has clearly stated:
-
If the property type is intrinsic, the function returns the original type of the member.
-
If the property type is user defined, the type of the return value is the same as the type of the return value of the MemberValue function.
By default, the value is coerced to be a string. If TYPED is specified, the return value is strongly typed.
Although the TYPED flag is optional, in my case, I should have used it.
Here is the syntax:
Member_Expression.Properties(Property_Name, TYPED)
To return the Number of Cars Owned as a number, I would add the TYPED flag to the properties function.
The original data type of Number of Cars Owned is number
Looking at the Number of Cars Owned attribute, the original data type is UnsignedTinyInt.