dbTalk Databases Forums  

MDX calc question

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


Discuss MDX calc question in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kristl
 
Posts: n/a

Default MDX calc question - 07-14-2006 , 03:50 PM






I have a cube that has two employee measures - termination_flag and
number_of_days_employed.

I want to take each record and use these two measures to create counts
in fields named "0-30 days", "30 to 60 days" etc.

so If the term_flag is 1 and the number_of_days falls within range, the
value is 1, otherwise it is zero.

The MDX I am currently using is:
Iif([Measures].[Term Count] >0 AND [Measures].[Days Employed] <30, "1",
"0")

THis works when I drill all the way down to a single employee for a
single day but does not work by rolling up into counts of each type on
higher levels.

How do I write this query so that calculates on the lowest level but
sums on every higher level?

Thanks in advance.


Reply With Quote
  #2  
Old   
kristl
 
Posts: n/a

Default Re: MDX calc question - 07-18-2006 , 10:51 AM






No one helped me so I had to help myself.

I realized my original conditional statement needed to be embedded in a
Sum function, where the set was based on the Descendents function. Here
is my final code. It works great.

Sum(Descendants([Site_Team_Agent].[AgentSite].CurrentMember,
[Site_Team_Agent].[Agent]),(Iif([Measures].[Term Count] >0 AND
[Measures].[Days Employed] <30, 1, 0)))

btw notice also that I wasn't supposed to have quotes around my 0 and 1
in the conditional statement (doh!) since these made the values
character values.


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.