Forward cover stock measure using cumulative sum



I am having a problem with an mdx statement which goes as follows...
trying to calculate a count of days where the cumulative sum going
foward in time of [Sales U ActPlan TY] is less than the value on the
selected date of [SOH] measure.

This would give the number of days that stock on hand would cover
planned sales.

So far i have this...

WITH
MEMBER Measures.[Tot Sales U ActPlan TY] as SUM([Date].[Dates].
[Week].&[2008101]:[Date].[Dates].CurrentMember,[Measures].[Sales U
ActPlan TY])
MEMBER Measures.[Number Of Days] AS Count(Descendants([Date].[Dates],
[Date].[Dates].[Date]))
MEMBER Measures.[Tot Number Of Days] AS SUM([Date].[Dates].
[Week].&[2008101]:[Date].[Dates].CurrentMember,[Number Of Days])
MEMBER Measures.[SOH U] as ([SOH U TY], [Date].[Dates].
[Week].&[2008101])

MEMBER measures.[No Days StockCover] as iif(([Tot Sales U ActPlan TY]-
[SOH U])>0 , [Tot Number Of Days]+([SOH U]/[Tot Sales U ActPlan TY]) ,
0)

SELECT {[Date].[Dates].[Week].&[2008101]:null} ON COLUMNS ,
{[Tot Sales U ActPlan TY],[Number Of Days],[SOH U],[No Days
StockCover] } ON ROWS
FROM [CurrentCube]

The problem is i need to create a calculated measure [No Days
StockCover] when selecting a single [Date] or [Week] or [Month] in the
column and not a set of dates?
How would i go about doing this?

many thanks,
Gareth
.


Loading