dbTalk Databases Forums  

Conditional Sum

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


Discuss Conditional Sum in the microsoft.public.sqlserver.olap forum.



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

Default Conditional Sum - 05-16-2005 , 04:47 PM






I am trying to sum all descendants of a specific member based upon a
conditional statement. I am new to this, so I am not 100% sure of the best
means of accomplishing this. Here is what I have so far, but it obviously
doesn't work.

Sum(Descendants(Account_GL.CurrentMember),IIF(Acco unt_GL.CurrentMember.Properties("RATEACCT")<>"", ADB * ADBRATE,SUM()





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

Default RE: Conditional Sum - 05-17-2005 , 12:20 PM






I ended up changing the statement to look like this and it appears to be
working. Is this the most efficient manner to approach this problem?

IIF(Account_GL.Currentmember.Properties("RATEACCT" )<>"",ADB *
ADBRATE,Sum(Descendants(Account_GL.Currentmember),
IIF(ISLEAF(Account_GL.Currentmember) OR
(Account_GL.Currentmember.Properties("RATEACCT")<> ""), ADB * ADBRATE, 0))),
solveorder = 8

"txksa" wrote:

Quote:
I am trying to sum all descendants of a specific member based upon a
conditional statement. I am new to this, so I am not 100% sure of the best
means of accomplishing this. Here is what I have so far, but it obviously
doesn't work.

Sum(Descendants(Account_GL.CurrentMember),IIF(Acco unt_GL.CurrentMember.Properties("RATEACCT")<>"", ADB * ADBRATE,SUM()





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.