Quote:
The required formula is Currenty Inventory Value/(CostofGoods Last 3 months)
*4. |
I would do this by breaking the formula into 3 parts.
1) Get the Current Inventory Value
2) Get the Cost of Goods for the last 3 months
3) Caculate Currenty Inventory Value/(CostofGoods Last 3 months) *4.
-==================================================
WITH
-- Step 1
MEMBER Measures.CurrentInvValue as 'sum(Tail(FILTER(Descendants
(Time.CurrentMember,,LEAVES),(Time.Currentmember,M easures.Inv_Value) >
0),1),Measures.Inv_Value)'
-- Step 2
MEMBER Measures.COG3Mths as 'IIF(Time.CurrentMember.Level IS
Time.Month,SUM(Time.CurrentMember.Lag
(3):Time.CurrentMember,Measures.COG),NULL)'
-- Step 3
MEMBER Measures.Final as 'Measures.CurrentInvValue / Measures.COG3Mths *
4'
SELECT
{Measures.Inv_Value
,Measures.COG
,Measures.CurrentInvValue
,Measures.COG3Mths
,Measures.Final} ON COLUMNS,
Time.Month.members ON ROWS
FROM <Your Cube Name goes here>
-==================================================
Notes:
I have set up the above MDX query so that it should work in the MDX
Sample app. I have not included all the columns in your sample
resultset, I have just done the calc that you said was giving you the
most trouble.
* Step 1 should always give you the last inv_value for the current time
period at any level.
* Step 2 is filtered so that it only returns a value when you are
looking at the month level (you may want to alter this logic)
HTH
--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell