dbTalk Databases Forums  

Geometrically Linked Quartley Totals - MDX Help

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


Discuss Geometrically Linked Quartley Totals - MDX Help in the microsoft.public.sqlserver.olap forum.



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

Default Geometrically Linked Quartley Totals - MDX Help - 07-17-2006 , 06:42 PM






I am trying to geometrically link quarter totals based on the following
formula.

Dimensions:
Date
2005
Q1
Month 1 - 2%
Month 2 - 3%
Month 3 - 2.5%
Q2 - 3%
Q3 - 4%
Instrument
Portfolio


The formula for Q1 would be (1+2%*1+3%*1.2.5%)-1. See
http://www.russell.com/ca/Investor_S..._of_Return.asp
for more information.


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

Default Re: Geometrically Linked Quartley Totals - MDX Help - 07-18-2006 , 06:14 AM






Solved the problem using Excel!Product function:

IIF([Date].[Year - Quarter - Month].CurrentMember.Level.Ordinal >
[Date].[Month].Level.Ordinal AND[Measures].[PositionReturn]<>0 ,
Excel!Product (
SetToArray (
Filter (
[Date].[Year - Quarter - Month].Children,
Not IsEmpty ([Measures].[PositionReturn])
),
[Measures].[PositionReturn]+1
)

)-1,0)

Quote:
I am trying to geometrically link quarter totals based on the following
formula.

Dimensions:
Date
2005
Q1
Month 1 - 2%
Month 2 - 3%
Month 3 - 2.5%
Q2 - 3%
Q3 - 4%
Instrument
Portfolio


The formula for Q1 would be (1+2%*1+3%*1.2.5%)-1. See
http://www.russell.com/ca/Investor_S..._of_Return.asp
for more information.


Reply With Quote
  #3  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Geometrically Linked Quartley Totals - MDX Help - 07-18-2006 , 08:11 AM



A technique I once saw Itzik Ben-Gan demonstrate in T-SQL in order to
produce a product of values might help you here.

The basic mathematical proof for this technique was the following

logN (val1*val2*...*valn) = logN(val1) + logN(val2) + ... + logN(valn)
logN (val1*val2*...*valn) = sum(logN(col_with_vals))
val1*val2*...*valn = EXP(sum(logN(col_with_vals)))

You take the log of the value, sum

You did not mention if you are using AS2k or AS2k5. Below is a rough
sample against the AS2k5 Adventure Works sample database. I did not have
a rate measure handy so I fabricated one from the 2 reseller order
measures. I have included all the raw figures so that you can confirm
the results.

Quote:
WITH
MEMBER Measures.QtyPerOrder as measures.[reseller Order Count]
/ measures.[Reseller Order Quantity]

MEMBER Measures.GeometricLinkedTotal as
EXP(
SUM(
Descendants([Date].Calendar.CurrentMember
,[Date].[Calendar].[Month])
,LN(1+Measures.QtyPerOrder)
)
)
SELECT
{[Measures].[Reseller Order Count]
,[Measures].[Reseller Order Quantity]
,[Measures].[QtyPerOrder]
,Measures.GeometricLinkedTotal} ON COLUMNS,

Descendants([Date].[Calendar].[Calendar Year].&[2003]
,[Date].[Calendar].[Month],SELF_AND_BEFORE) ON ROWS
FROM [Adventure Works];
Quote:
--
Regards
Darren Gosbell - SQL Server MVP
Blog: http://www.geekswithblogs.net/darrengosbell

In article <1153179777.752840.318630 (AT) p79g2000cwp (DOT) googlegroups.com>,
michael (AT) michaelpusateri (DOT) com says...
Quote:
I am trying to geometrically link quarter totals based on the following
formula.

Dimensions:
Date
2005
Q1
Month 1 - 2%
Month 2 - 3%
Month 3 - 2.5%
Q2 - 3%
Q3 - 4%
Instrument
Portfolio


The formula for Q1 would be (1+2%*1+3%*1.2.5%)-1. See
http://www.russell.com/ca/Investor_S..._of_Return.asp
for more information.


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.