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.
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];
--
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. |