dbTalk Databases Forums  

Using Member Properties in Calculated Measures

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Using Member Properties in Calculated Measures in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
davidb@mercurydata.com
 
Posts: n/a

Default Using Member Properties in Calculated Measures - 05-04-2005 , 02:59 PM






I need an MDX expression that will return a Number of Inspections per
Day. My cube contains a [Number of Inspections] measure that will
return the number for the current member of the time dimension, which
is named Period. Period contains a [Year Num] level and a [Period Name]
level (which is keyed to the month).

With the data only on the month level of detail, I must derive
Inspections per Day by dividing the number of inspections by the number
of working days in the period. To do this, I have created a field in
the relation table behind the Period dimension to store the number of
working days in each period. I created an additional field to store the
number of working days in the year. In this field, I just put the total
working days per year so all periods in 2004 have 262; The records in
2005 have 85 for the number of working days from Jan to Apr. This let
me create Member Properties on the Period and Year levels. I named them
both "Working Days". This worked great. I can create a Calculated
Measure that gives me back this value. Its expression is:

[Period].CurrentMember.Properties("Working Days")

I thought this would be the hard part. One would think that I could
then create another Calculated Measure that divided [Nbr of
Inspections] / [Nbr of Working Days] for my final result. But I get
#ERR in every cell.

Can anybody see what I'm doing wrong?

The only other thing of note is that there is sparsity in the [Nbr of
Inspections] measure. There is another dimension named Inspector. If an
Inspector did not do any inspections in a certain month, then those
cells are empty.

Any ideas would be appreciated.

-David


Reply With Quote
  #2  
Old   
davidb@mercurydata.com
 
Posts: n/a

Default Re: Using Member Properties in Calculated Measures - 05-11-2005 , 08:44 AM






I'm pleased to be able to answer my own question. I guess it pays to
just put the problem down for awhile and look later with a fresh pair
of eyes.

The problem is that the Properties function seems to return property
values as a string and not as the original data type. I wrapped the
denominator in the StrToValue() function and it all worked.

StrToValue( [Period].CurrentMember.Properties("Working Days") )

-David


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.