Home > MDX Challenges > MDX #12 – Do not forget the TYPED flag in the Properties() function

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:

    By default, the value is coerced to be a string. If TYPED is specified, the return value is strongly typed.
  • 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.

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.

image

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.

image

About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 165 other followers

%d bloggers like this: