dbTalk Databases Forums  

command mdx compute wrong

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


Discuss command mdx compute wrong in the microsoft.public.sqlserver.olap forum.



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

Default command mdx compute wrong - 11-12-2003 , 07:39 PM






I have met a problem:
There is the description
I have a cube ,in which there is a Dimension named Account,and the
Account has a member properity Direction(if the value is "D" means
Debit or if it is "C" means Credit),and also the cube have two
measures,CreditMoney and DebitMoney,finally I compose a command
[Money]in this cube which get its value according to the direction of
Account ,the mdx is

iif([Account].currentmember.Properties("Direction")="C",(-1)*[Measures].[creditmoney],[Measures].[Debitmoney])

then I process the cube ,and get the result form the Excel:
[Money]
fiscal fee interest -456635.67
handling charge 586.77
other 433
fiscal fee Total 457655.44

the detail records are right ,but the "fiscal fee Total" are totally
wrong,
can anyone give me a hand

Reply With Quote
  #2  
Old   
Mosha Pasumansky [MS]
 
Posts: n/a

Default Re: command mdx compute wrong - 11-13-2003 , 06:33 PM






<dlm123 (AT) etang (DOT) com> wrote

Quote:
I have met a problem:
There is the description
I have a cube ,in which there is a Dimension named Account,and the
Account has a member properity Direction(if the value is "D" means
Debit or if it is "C" means Credit),and also the cube have two
measures,CreditMoney and DebitMoney,finally I compose a command
[Money]in this cube which get its value according to the direction of
Account ,the mdx is


iif([Account].currentmember.Properties("Direction")="C",(-1)*[Measures].[cre
ditmoney],[Measures].[Debitmoney])
Quote:
then I process the cube ,and get the result form the Excel:
[Money]
fiscal fee interest -456635.67
handling charge 586.77
other 433
fiscal fee Total 457655.44

the detail records are right ,but the "fiscal fee Total" are totally
wrong,
can anyone give me a hand
Is Money a calculated member ? Then the results are correct. If you wanted
Fiscal Fee Total to aggregate its children, then you can use either custom
rollup formulas, calculated cells, or (for best performance) try to push
this logic into measure bindings expression, such that -1*... will be
applied during processing.

--
==================================================
Mosha Pasumansky - http://www.mosha.com/msolap
Development Lead in the Analysis Server team
All you need is love (John Lennon)
Disclaimer : This posting is provided "AS IS" with no warranties, and
confers no rights.
==================================================




Reply With Quote
  #3  
Old   
Barry Hensch
 
Posts: n/a

Default Re: command mdx compute wrong - 11-13-2003 , 07:40 PM



You may want to consider using the unary operator functionality. In
other words add a column in your account dimension table and indicate
how the GL account aggregates (either add, substract, or does not
roll-up) up into its parent. The unary operator will allow you to get
the correct totals up and down the hierarchy.

There is a good example of this in the Account dimension in the Food
Mart 2000 database.

Otherwise you may need to create a couple of calculated members, one
where this calculation only takes place at a certain level.ordinal
position (i.e. Iif([Account].Level.Ordinal=3,your IIF formula). Then
a second one which uses something like
SUM(Descendants([Account],,LEAVES),[Measures].[Your Measure]).

Hope this helps.

Barry

Reply With Quote
  #4  
Old   
dlm123@etang.com
 
Posts: n/a

Default Re: command mdx compute wrong - 11-14-2003 , 07:09 AM



Thank you for your help,Barry Hensch,I have used the second way you give out
,it really work, thank you
barryh (AT) quadrus (DOT) com (Barry Hensch) wrote in message news:<5757a2ca.0311131740.32ffb45b (AT) posting (DOT) google.com>...
Quote:
You may want to consider using the unary operator functionality. In
other words add a column in your account dimension table and indicate
how the GL account aggregates (either add, substract, or does not
roll-up) up into its parent. The unary operator will allow you to get
the correct totals up and down the hierarchy.

There is a good example of this in the Account dimension in the Food
Mart 2000 database.

Otherwise you may need to create a couple of calculated members, one
where this calculation only takes place at a certain level.ordinal
position (i.e. Iif([Account].Level.Ordinal=3,your IIF formula). Then
a second one which uses something like
SUM(Descendants([Account],,LEAVES),[Measures].[Your Measure]).

Hope this helps.

Barry

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.