Hi,

I need help with efficient MDX for the following computation. Four measures of interest, over time

Replenishment, TargetInventory, Demand, BeginningOnHand, EndingOnHand.

Demand and TargetInventory are measures which are defined elsewhere, and available at the point where the below computation needs to take place.

At time t=0, BeginningOnHand(t=0) = 50, Demand(t=0) = 150, TargetInventory(t=0) = 100

Replenishment(t=0) = Demand(t=0) + TargetInventory(t=0) - BeginningOnHand(t=0) = 150 + 100 - 50 = 200

EndingOnHand(t=0) = BeginningOnHand(t=0) + Replenishment(t=0) - Demand(t=0) = 50+200-150 = 100.

For future time buckets t > 1, the computation is defined as below:

Replenishment(t) = Demand(t) + TargetInventory(t) - BeginningOnHand(t)

BeginningOnHand(t) = EndingOnHand(t-1)

EndingOnHand(t) = BeginningOnHand(t) + Replenishment(t) - Demand(t)

I need to solve the above computation in time, with the recursion in time stopping at t=0, effectively in MDX. Any help will be greatly appreciated.

Rajeev

RK

**View Complete Post**

## Data Points: Column Expressions, DataRelations, and Computations

This month John Papa fields some of his favorite questions regarding data manipulation with ADO.NET.

John Papa

MSDN Magazine January 2007